Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Max sum query
Message
De
06/09/2011 11:45:39
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Max sum query
Divers
Thread ID:
01522804
Message ID:
01522804
Vues:
71
Hi

going with gregorys sql query
	
select max(total), ;
			member_ref ;
		from ( ;
			select	sum(amount) as Total, ;
					member_ref, ;
					description ;
			from payments ;
				where description like '%Test%' ;
				group by member_ref, description ;
			) X ;
		group by 2
How could I alter that SQL to return

'Tier1' if the max total is up to 10

'Tier2' max total 10 to 20

and 'Tier3' over 20

Thanks

Nick
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform