Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TOP 10 within a group
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00913710
Message ID:
00913734
Vues:
16
Fred,
Try
SELECT suppliercode, productcode, dollarsales
	FROM mytable mt1
	WHERE dollarsales IN (
		SELECT TOP 10 dollarsales 
			FROM mytable mt2 
			WHERE mt2.suppliercode = mt1.suppliercode
				AND mt2.productcode = mt1.productcode
			ORDER BY dollarsales DESCENDING)	
>I have a table with suppliercode,productcode,dollarsales
>
>I want the top 10 product codes for each suppliercode. Is this possible
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform