Mysql两个查询结果相加?错误:Every derived table must have its own alias
SELECT username,SUM(ycnum) AS yznum,SUM(zfnum) AS zfnum FROM (select * from tempactive where exists (select * from topic1activeuser where username=tempactive.username) UNION select * from topic1activeuser where exists (select * from tempactive where username=topic1activeuser.username)) GROUP BY username
一直报错Every derived table must have its own alias
提示要给子查询加上别名
SELECT username,SUM(ycnum) AS yznum,SUM(zfnum) AS zfnum FROM (select * from tempactive where exists (select * from topic1activeuser where username=tempactive.username) UNION select * from topic1activeuser where exists (select * from tempactive where username=topic1activeuser.username)) AS total GROUP BY username
select * from tempactive where exists (select * from topic1activeuser where username=tempactive.username)
结果1:
select * from topic1activeuser where exists (select * from tempactive where username=topic1activeuser.username)
结果2:
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。