mysql语法错误:Every derived table must have its own alias

Posted 蜜桃婷婷酱

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql语法错误:Every derived table must have its own alias相关的知识,希望对你有一定的参考价值。

mysql查询报错如图

在这里插入图片描述

报错原因

every derived table must have it own

alias 翻译过来就是:每一个派生出来的表都必须有一个自己的别名。

就是说子查询没有别名

解决方案

给子查询起个别名,可以写成这种形式
select count(*) from (select * from ……) as total;

以上是关于mysql语法错误:Every derived table must have its own alias的主要内容,如果未能解决你的问题,请参考以下文章

mysql union出错: "Every derived table must have its own alias"

ERROR 1248 (42000): Every derived table must have its own alias

Every derived table must have its own alias

SQL 语法错误 (MYSQL 5.0)

$P5240 Derivation$

小白学习MySQL - Derived Table