sql query to find the duplicate records

后端 未结 5 1136
谎友^
谎友^ 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 08:05

    You can't do it as a simple single query, but this would do:

    select title
    from kmovies
    where title in (
        select title
        from kmovies
        group by title
        order by cnt desc
        having count(title) > 1
    )
    

提交回复
热议问题