Max query

ocp&mcsd

The Hitman
Local time
Today, 12:06
Joined
Jan 25, 2006
Messages
113
Dear all,

How are you??

I have a small question…

I have the below table:

CustomerName ProductName Price
John W 100
John X 120
David Y 80
David Z 60


I want a query to return back the maximum price product for each customer as follow:

CustomerName ProductName Price
John X 120
David Y 80


Thanks in advance
 
Last edited:
Seems you could simply use a totals query grouping on name & product and max'ing the price...

???
ken
 
Sorry..
It doesn't work...
 
Sorry - I mis-read your question.

Let me think for a few minutes...
 
This I think takes 2 queries, 1 group on customer and max on price then join this back to table in query 2 joining on price to select all the info.

Brian
 
This I think takes 2 queries, 1 group on customer and max on price then join this back to table in query 2 joining on price to select all the info.

Brian

How?

How this SQL statement can be written??
 
This I think takes 2 queries, 1 group on customer and max on price then join this back to table in query 2 joining on price to select all the info.

Brian


That's what I was thinking... I thought there may be another way but I can't think of any at the moment...

:)
ken
 

Users who are viewing this thread

Back
Top Bottom