[英]SQL - How to select rows with the same ID values where all other column values are also identical
我在標題中找不到上述問題的答案。
我需要 select 所有具有相同 ID的行和所有其他列值也必須相同。 該表由 20 列組成。
任何建議將不勝感激。 非常感謝。
這個怎么樣
select id, name, ...other fields
from my_table
where id in (
Select id, count(id)
from my_table
group by id, name, ...other fields
having count(id) > 1
)
相應地更改 group by 和 where 條件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.