query for max per item

R

rbeach

I ahve a query with the itemID and Cost as per example below:

ItemID Cost
1 1.15
1 1.25
1 1.19
2 3.65
2 3.97
2 3.84

I need to get the max cost for each ItemID. The result of the query should be:

ItemID Cost
1 1.25
2 3.97

Your assistance is appreciated.
 
M

Marshall Barton

rbeach said:
I ahve a query with the itemID and Cost as per example below:

ItemID Cost
1 1.15
1 1.25
1 1.19
2 3.65
2 3.97
2 3.84

I need to get the max cost for each ItemID. The result of the query should be:

ItemID Cost
1 1.25
2 3.97


SELECT ItemID, Max(Cost) As MaxCost
FROM thetable
GROUP BY ItemID
 
J

John W. Vinson

I ahve a query with the itemID and Cost as per example below:

ItemID Cost
1 1.15
1 1.25
1 1.19
2 3.65
2 3.97
2 3.84

I need to get the max cost for each ItemID. The result of the query should be:

ItemID Cost
1 1.25
2 3.97

Your assistance is appreciated.

Create a Query based on your table. Change it to a Totals query by clicking
the Greek Sigma icon. Leave the default "Group By" on the Totals row under
ItemID, and change it to Max under the Cost field.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top