Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Max sum query
Message
From
06/09/2011 11:45:39
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Max sum query
Miscellaneous
Thread ID:
01522804
Message ID:
01522804
Views:
72
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
Next
Reply
Map
View

Click here to load this message in the networking platform