报错:Every derived table must have its own alias

报错:Every derived table must have its own alias

翻译:每个派生表都必须有自己的别名

原因:MySQL要求每个派生表都必须有自己的别名,因为你没给它起名

解决:给派生表起名,as tableName

 

原sql语句

select id, name, date from
(select * from A
union all
select * from B
order by date desc)
group by id;

修改后的sql语句

select id, name, date from
(select * from A
union all
select * from B
order by date desc) as c
group by id; 

posted @ 2019-04-23 21:52  亭子亭子大亭子  阅读(17930)  评论(0编辑  收藏  举报