mysql - Check for dupes in db with TWO rows -


i´d check dupes in mysql comparing 2 columns:

linked duplicate doesn't match it's finding duplicate values on specific columns. question finding rows have said duplicate values.

example:

id    column1    column2 -------------------------        3          1     <-this row dupe        3          2        3          3        3          1     <-this row dupe 

i'd have list this:

id    column1    column2 -------------------------         3        1         3        1 

how should query like?

my thinking:

select * table column1 && column2 dupe ;) 

you can use find duplicates:

select column1, column2  yourtable  group column1, column2  having count(*) > 1; 

and show actual duplicate rows can join against results of above query:

select * yourtable yt1  join (select column1, column2  yourtable  group column1, column2  having count(*) > 1) yt2 on (yt2.column1=yt1.column1 , yt2.column2=yt1.column2); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -