group by后面再去重复
时间: 2023-08-19 16:12:46 浏览: 128
在使用group by后,如果还需要进一步去重复,可以使用distinct关键字。distinct可以用于查询结果中去除重复的行。例如,可以使用以下语句来对group by后的结果进行去重复操作:
SELECT DISTINCT column1, column2
FROM table
GROUP BY column1, column2
HAVING COUNT(*) > 3
这样可以保证查询结果中的每一行都是唯一的,并且满足重复次数大于3的条件。\[1\]
#### 引用[.reference_title]
- *1* [mysql 过滤重复数据 group by和distinct](https://blog.csdn.net/smile_YangYue/article/details/105074141)[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^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [Mysql 去除重复数据和去除同名列(distinct、group by、using())](https://blog.csdn.net/qq_33562122/article/details/123519827)[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^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文