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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -