johnny 发表于 2016-9-9 08:40:23

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)也不行。


页: [1]
查看完整版本: 197、求出发帖最多的人: