group by

N

Nancy

How do I use group by for the following:
data has 3 records:
jo 8/2003 48004
jo 9/2003 48003
jo 7/2003 48009

I want the middle record to be my final answer, but if I
do a group by name, max on date, max on zip code, my final
answer will be "Jo 9/2003 48009" instead of "Jo 9/2003
48003"

Please help!

Thanks
 
B

Brian Camire

You might try a query whose SQL looks something this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
[Your Table].[Date] =
(SELECT
Max([Self].[Date])
FROM
[Your Table] AS [Self]
WHERE
[Self].[Name] = [Your Table].[Name])
 
N

Nancy

This is great ... I tried it and it works ... Thanks

-----Original Message-----
You might try a query whose SQL looks something this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
[Your Table].[Date] =
(SELECT
Max([Self].[Date])
FROM
[Your Table] AS [Self]
WHERE
[Self].[Name] = [Your Table].[Name])



Nancy said:
How do I use group by for the following:
data has 3 records:
jo 8/2003 48004
jo 9/2003 48003
jo 7/2003 48009

I want the middle record to be my final answer, but if I
do a group by name, max on date, max on zip code, my final
answer will be "Jo 9/2003 48009" instead of "Jo 9/2003
48003"

Please help!

Thanks


.
 

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