报错: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;