Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicates are known and now to delete them
Message
 
 
To
24/04/2012 17:20:31
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01542530
Message ID:
01542531
Views:
39
Which of two duplicate records you want to delete? You have to express it in the way that it can be used in delete statement..

>I have the following SQL which returns 192 records:
>
>
>SELECT Client.NoRegion,Client.CRC32,Client.FirstName,Client.LastName,COUNT(*)
> FROM Client GROUP BYClient.NoRegion,Client.CRC32,Client.FirstName,Client.LastName HAVING COUNT(*) > 1
>
>
>Note that the fields are fictive as those are not the real field names. So, lets just concentrate on the logic of the SQL.
>
>This is from a 26 million record table. The result means that I have to remove 192 records.
>
>Now, I need to find a way to easily run or adapt this SQL so it will remove those 192 records. What would be the best approach to take?
>
>Note that the count is 2 for each 192 returned records. So, this is why I know that I have 192 records which need to be removed. This is the result of a bad process which happened a few years ago. We would like to clean them up from the table.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform