Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select max sum amount
Message
From
06/09/2011 11:10:18
 
 
To
06/09/2011 10:48:51
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01522791
Message ID:
01522797
Views:
46
>Hi
>
>I have
>
>
>
>select sum(amount) as [total],
>		member_ref,
>		description 
>from payments 
>where description like '%Test%' 
>group by member_ref,description 
>
>
>
>how can I select out only the maximum sum amount for each member_ref .
>
>Thanks
>
>Nick

The max of the sum - translate to sql server
	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
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform