sql query to find the duplicate records -


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

for example:

getting count can done

select title, count(title) cnt kmovies group title order cnt desc 

and result

title cnt  ravi   10 prabhu  9 srinu   6 

now query result below:

ravi ravi ravi ...10 times prabhu prabhu..9 times srinu srinu...6 times 

if rdbms supports on clause...

select    title     (     select        title, count(*) on (partition title) cnt           kmovies     ) t order    cnt desc 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -