如果通过SQL在整行中存在重复,我想找到重复。如何在这里找到2行,所有值都有重复项,如
数据集
ConcurrentQueue<T>
结果集
id employee_name dept Dept_name
1 Abhijit 10 Physics
1 Abhijit 10 Physics
2 Debjit 20 Chemis
3 partha 30 Maths
答案 0 :(得分:4)
您可以使用cols
进行count(*)&gt; 1分组select id, employee_name , dept, Dept_name
from my_table
group by id, employee_name , dept, Dept_name
having count(*) > 1
答案 1 :(得分:2)
具有子句
的简单分组和基于计数的过滤器Select id, employee_name, dept, dept_name
From your_table
Group by id, employee_name, dept, dept_name
Having count(*) > 1;
答案 2 :(得分:0)
SELECT a.* from employees a, employees b WHERE a.id = b.id and a.employee_name = b.employee_name and a.dept = b.dept;
dept_name对于具有相同id的deps可能是相同的,因此不需要将它包含在where子句中