I need only Unique records at the end of the Query.

Tools
Enthusiast

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.
2 REPLIES
Enthusiast

Re: I need only Unique records at the end of the Query.

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.
Enthusiast

Re: I need only Unique records at the end of the Query.

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