飞网论坛

标题: 197、求出发帖最多的人: [打印本页]

作者: johnny    时间: 2016-9-9 08:40
标题: 197、求出发帖最多的人:
197、求出发帖最多的人:

select authorid,count(*) total from articles

group by authorid

having total=

(select max(total2) from (select count(*) total2 from articles group by authorid) as t);

 

select t.authorid,max(t.total) from

(select authorid,count(*) total from articles )as t

这条语句不行,因为max只有一列,不能与其他列混淆。

 

select authorid,count(*) total from articles

group by authorid having total=max(total)也不行。







欢迎光临 飞网论坛 (https://bbs.cfei.net/) Powered by Discuz! X3.2