HAVING 搜索条件在进行分组操作之后应用
HAVING 搜索条件在进行分组操作之后应用;
如:查询帖子访问量大于15的用户id;
select t.user_id,u.name,sum(count_view) from t_topic t left join t_users u on t.user_id=u.id GROUP BY user_id HAVING SUM(count_view)<15
佛语:我本求心不求佛,了知三界空无物,若欲求佛但求心,只这心心心是佛
HAVING 搜索条件在进行分组操作之后应用;
如:查询帖子访问量大于15的用户id;
select t.user_id,u.name,sum(count_view) from t_topic t left join t_users u on t.user_id=u.id GROUP BY user_id HAVING SUM(count_view)<15