Every derived table must have its own alias翻译:每个派生表都需要有自己的别名
即子查询出来得出的表需要给他一个别名!
select count(1)
from (
SELECT MAX(id) FROM message
WHERE STATUS != 2 AND from_id != 1
)
例如这个sql语句目标是查询通过子查询得出来的数据有多少行
运行后会出现Every derived table must have its own alias错误!
通过修改:在子查询后面为查询出来的数据添加表名m,就可以查询出来数据
select count(1)
from (
SELECT MAX(id) FROM message
WHERE STATUS != 2 AND from_id != 1
) as m