Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicates are known and now to delete them
Message
De
24/04/2012 17:41:48
 
 
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:
01542534
Vues:
40
>Assuming you want to keep the first entry:
>
>
>;with cte as (select PK, row_number() over (partition by all these fields order by DateFld) as Rn from Client)
>
>delete from cte where Rn > 1
>
>
>This will keep the row with the first date. You can pick any other column in the order by and if you don't care which row to keep you can use
>
>ORDER BY (select 0)

It is not clear how I should integrate this cte syntax into the original SQL. Could you just show me an example? Thanks
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform