Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing the last child record from same parent if seque
Message
De
26/06/2015 12:03:38
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01621484
Message ID:
01621487
Vues:
49
>
>;with cteRows as (select *, row_number() over (partition by ClientID order by AddedDate DESC) as RowNumber 
>from Invoices)
>
>delete from cteRows R where RowNumber = 1  and Status = 'Completed' 
>and exists (select * from cteRows where RowNumber = 2 and Status = 'Completed' 
>and R.ClientId = cteRows.ClientId)
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
Répondre
Fil
Voir

Click here to load this message in the networking platform