sql语句疑问,max()内不能使用统计之后的结果吗

```select c_type,c_user_id,count(c_type) l from s_content where c_type=2 GROUP BY c_user_id

我要查找count(c_type)的最大值,但是max只让我取表中的字段。我要取我统计结束后的字段,只显示count(c_type)最大的那个用户的那一行,求助!如何改写sql语句!


![图片说明](https://img-ask.csdn.net/upload/201905/23/1558617738_479870.png)

外面可以再套一层select *()

试试下面的

SELECT a.c_type,a.c_user_id,max(a.c) from (SELECT  count(c_type) c,c_type, c_user_id from s_content 
where c_type=2
GROUP BY c_user_id) a

SELECT a.c_type,a.c_user_id,max(a.c) from (SELECT count(c_type) c,c_type, c_user_id from s_content
where c_type=2
GROUP BY c_type, c_user_id) a GROUP BY c_type, c_user_id