Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Distinct Query 1

Status
Not open for further replies.

JazzMaan

Programmer
Jun 15, 2004
57
US
I have the following scenario

store_id , amount
1, 20
1, 33
2, 39
3, 31

I would like to get the distinct records containg the store_id and the max amount.


I have tried:
select store_id, max(amount)
from store
group by store_id, amount



 
Close. Try this.

Code:
select store_id, max(amount)
from store
group by store_id


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top