select an entire row based on Max value in a single field

S

SAM

i need to select an entire row wfrom an access database based on the Maximum
value within a single field
 
B

Brendan Reynolds

SAM said:
i need to select an entire row wfrom an access database based on the
Maximum
value within a single field


SELECT * FROM core_students WHERE studentid = (SELECT MAX(studentid) FROM
core_students)

Replace "core_students" with your table name and "studentid" with your field
name.
 
S

SAM

Thanks Brendan, but not quite, it only returned a single record. I need it
to pick the highest from groups

xxxx yyyy 03
xxxx yyyy 06
xxxx yyyy 04
xxxy yyyy 03
xxxy yyyy 02

so the return would be

xxxx yyyy 06
xxxy yyyy 03
 
K

KARL DEWEY

Try this --
SELECT [X], [Y], Max([Z]) AS MaxOfZ
FROM YourTable
BROUP BY [X], [Y];
 

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