MySQL 查重语句
时间: 2023-12-12 17:34:24 浏览: 111
MySQL 查询语句
以下是MySQL查重语句的两个例子:
1. 查找表中重复的记录
```sql
SELECT col1, col2, COUNT(*)
FROM table_name
GROUP BY col1, col2
HAVING COUNT(*) > 1;```
2. 查找表中某个字段重复的记录
```sql
SELECT COUNT(*), IndentId
FROM t_customerforsale
GROUP BY IndentId
HAVING COUNT(*) > 1;
```
阅读全文