sql query to find the duplicate records

后端 未结 5 1154
谎友^
谎友^ 2020-12-31 07:24

what is the sql query to find the duplicate records and display in descending, based on the highest count and the id display the records.

for example:

gettin

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 07:59

    select distinct title, (
                   select count(title) 
                   from kmovies as sub 
                   where sub.title=kmovies.title) as cnt 
    from kmovies 
    group by title 
    order by cnt desc
    

提交回复
热议问题