查看: 2178|回复: 0
收起左侧

[数据库部分] 197、求出发帖最多的人:

[复制链接]

566

主题

713

帖子

3823

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3823
发表于 2016-9-9 08:40:23 | 显示全部楼层 |阅读模式
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)也不行。


来自安卓客户端来自安卓客户端
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 打开微信扫一扫