mysql having count语法
时间: 2023-10-16 14:06:58 浏览: 132
MySQL中的HAVING COUNT语法用于在GROUP BY子句中筛选聚合函数结果。具体语法如下:
SELECT column1, column2, ...
FROM table
GROUP BY column1, column2, ...
HAVING condition;
在HAVING子句中,可以使用COUNT函数来统计特定列的非重复记录数量,并通过条件筛选结果。例如,HAVING COUNT(status)<>COUNT(DISTINCT(status))表示筛选出status列中非重复记录数量与所有记录数量不相等的结果。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Mysql之Having常见用法](https://blog.csdn.net/weixin_47183348/article/details/105861315)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [mysql having的用法](https://blog.csdn.net/cristianoxm/article/details/126080731)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文