All Forums Tools
teramurali 21 posts Joined 11/08
19 Mar 2009
I need only Unique records at the end of the Query.

Write a single SQL to delete duplicate records from the a single table based on a column value. I need only Unique records at the end of the Query.

20 Mar 2009

To identify the rows you can have this approach.SELECT [the number columns or column based on which u want to identify the duplicates],COUNT(*) FROM [whatever is your table]GROUP BY 1,2,3,......[as the case may be based on columns selected above]After identifying change the select to delete and check.If the idea is to eliminate duplicates just used fastload. That is more effective.

Ramakrishna Vedantam, Tata consultancy services, Hyderabad

gander_ss 74 posts Joined 02/07
23 Mar 2009

Just one clarification needed.......Suppose u have 10 cols in your table and u are looking for unique values as per col1 and col2.Rest col values are completely different and doesn't depend on col1 and col2 value.Then in that case which row u want to remove..Regards,Subhash

You must sign in to leave a comment.