Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Syntax help
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01400647
Message ID:
01400689
Vues:
58
>Good point...closest down. Capture Date must be less than or equal to PO Date.

If it always less or equal, then the simple select will work
select * from (select TA.EDP, TB.Alert, Row_Number() 
OVER (Partition by TB.EDP ORDER BY Tb.CaptureDate DESC) as RowNum from TA 
INNER JOIN TB on TA.EDP = TB.EDP and TA.PoDate>=TB.CaptureDate) Derived where RowNum = 1
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform