我想知道如何在两列组合的表中找到重复值。
假设我的表有字段 id || name || father_name || region || dob
现在我如何找到结果集,例如:
.ie 我想找到三列相同的所有行。
select t1.*
from your_table t1
join
(
select name, father_name, region
from your_table
group by name, father_name, region
having count(*) >= 3
) t2 on t1.name = t2.name
and t1.father_name = t2.father_name
and t1.region = t2.region
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1245 次 |
| 最近记录: |