query for max per item

  • Thread starter Thread starter rbeach
  • Start date Start date
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.
 
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
 
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.
 
Back
Top