Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicates are known and now to delete them
Message
 
 
À
24/04/2012 17:20:31
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01542530
Message ID:
01542531
Vues:
40
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform