Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query question
Message
 
 
À
12/11/2009 14:32:31
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01434430
Message ID:
01434577
Vues:
40
>Sergey
>Thanks.
>I may have messed something up, but I'm getting two rows for each Sales Order
>I tried Naomi's and it works fine, so I'll use that one.
>Thanks again for your help.

Bill,

Sergey's code will work for you with this slight modification
SELECT t1.sono, t1.tcode, t1.tdate ;
	FROM mytable t1 ;
	WHERE t1.tdate = (SELECT MAX(tdate) FROM mytable t2 ;
					WHERE t1.sosno = t2.sono)
However, it is a slower method comparing with the others and it doesn't eliminate duplicates if you have the same max dates.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform