Find duplicates in the same table in MySQL

后端 未结 13 1900
感动是毒
感动是毒 2020-12-10 02:03

I have a table with two columns - artist, release_id

What query can I run to show duplicate records?

e.g. my table is

ArtistX : 45677
ArtistY         


        
13条回答
  •  北海茫月
    2020-12-10 02:05

    You can use a grouping across the columns of interest to work out if there are duplicates.

    SELECT
        artist, release_id, count(*) no_of_records
    FROM table
    GROUP BY artist, release_id
    HAVING count(*) > 1;
    

提交回复
热议问题