January 20, 2017 at 12:55 pm
I have a table with 10 to 12 columns, I am trying to find duplicate record for all the columns , I mean data should be same for all the columns.
Any one let me know the query?
January 20, 2017 at 1:00 pm
Can you post the DDL (create table) script, sample data as an insert statement and the expected output please?
😎
January 20, 2017 at 1:04 pm
the classic way would be to use GROUP BY HAVING count > 1
SELECT
Col1,Col2,Col3,Col10Or12
FROM
YourTable
GROUP BY Col1,Col2,Col3C,Col10Or12
HAVING COUNT(*) > 1
Lowell
January 20, 2017 at 1:06 pm
Lowell - Friday, January 20, 2017 1:04 PMthe classic way would be to use GROUP BY HAVING count > 1
SELECT
Col1,Col2,Col3,Col10Or12
FROM
YourTable
GROUP BY Col1,Col2,Col3C,Col10Or12
HAVING COUNT(*) > 1
And if you want to delete these duplicates, use one of the Row_Number() techniques mentioned here.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply