Help with a Max Query

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

Okay so I have a table with columns: A,B,C,D,E
There are many rows with the same value for A, but each
has a unique time stamp in E.
I want to select the lastest (max E) row for each unique A
value.

I feel like ripping my hair out because I know I have done
this before.......

Thanks for any help you can offer.
 
You might use a query whose SQL looks something like this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
[Your Table].[E] =
(SELECT
Max([Self].[E])
FROM
[Your Table] AS [Self]
WHERE
[Self].[A] = [Your Table].[A])

For a discussion on this and other approaches, you might refer to:

http://www.mvps.org/access/queries/qry0020.htm
 
That'd be it!
It's one of those said:
-----Original Message-----
You might use a query whose SQL looks something like this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
[Your Table].[E] =
(SELECT
Max([Self].[E])
FROM
[Your Table] AS [Self]
WHERE
[Self].[A] = [Your Table].[A])

For a discussion on this and other approaches, you might refer to:

http://www.mvps.org/access/queries/qry0020.htm

Okay so I have a table with columns: A,B,C,D,E
There are many rows with the same value for A, but each
has a unique time stamp in E.
I want to select the lastest (max E) row for each unique A
value.

I feel like ripping my hair out because I know I have done
this before.......

Thanks for any help you can offer.


.
 
Back
Top