You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Duplicate row errors

2 replies [Last post]
Bhavya's picture
User offline. Last seen 7 years 9 weeks ago. Offline
Joined: 03/19/2012
Posts: 3

Hi,
How can v check for duplicate rows in a record?

Saiyed's picture
Saiyed (not verified)
Re: Duplicate row errors

SELECT col1, col2,col3,count(col3)--put the last column of duplicate combination in Count()
FROM table1
GROUP BY col1,col2,col3
HAVING COUNT(col3) >1

Rahul Khandelwal's picture
Rahul Khandelwal (not verified)
Re: Duplicate row errors

if database is oracle try this.
self join
select A.key1, A.key2... from TABLE A, TABLE B where A.key1= B.key1 and A.key2 = B.key2 ... and A.ROWID <> B.ROWID