Re: How to find latest date/time in grouped rows

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



That wont do it...probably because I explained the problem poorly.
The id is not unique and I need the id, team and date where the date is the
latest date for the id. E.G.
1 TeamA 1/1/2009 -- gets chosen
1 TeamB 12/25/2008
2 TeamA 1/1/2008
2 TeamC 1/1/2009 -- gets chosen
essentially I'm looking for the last team assigned to a problem(id).
so I definitely think there has to be a 'group by' somewhere.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"Marshall Barton" wrote:

Dorian wrote:

I have a table with id, team, date
I need to select the id and team with the latest date
team can appear multiple times.

I tried SELECT ID, TEAM, MAX(DATE) GROUP BY ID but then it expects TEAM to
have an aggregate function. I just need the team on the record with the
latest date.


SELECT ID, TEAM, [DATE]
FROM table
WHERE [DATE] = (SELECT Max(X.DATE])
FROM table As X)

--
Marsh
MVP [MS Access]

.



Relevant Pages

  • Re: Terra Amata poo poo
    ... Absence of evidence then ... We know common chimps eat a small amount of monkey meat and ... which of course are savanna or open woodland type ... Don't forget that the C3C4 research did not include fish, ...
    (sci.anthropology.paleo)
  • Re: Freedoms Watch ? Whos freedom are they watching ?
    ... for me to inform them that I don't eat seafood. ... thing that seafood is good for is to feed bigger sea creatures. ... perch of even cod that some of the fish places use. ... Mama also made salmon cakes out of canned salmon which I ate as a kid ...
    (soc.retirement)
  • Re: Judge and jury in the coal powerplant case
    ... That's a bit of a strange and selective attitude to animals and food isn't ... Even God in the Bible tells his believers that they can all eat the meat ... order to choose something more suitable to eat like a prepacked luxury fish ... All this global change is garbage when there are many ...
    (uk.local.kent)
  • RE: Auto Increment by 1 Letter
    ... "Give someone a fish and they eat for a day; teach someone to fish and they ... Public Function Encode(strCode As String) As String ... next sequence of letters. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Judge and jury in the coal powerplant case
    ... So, by your reckoning then, its wrong to eat meat, unless you're starving, ... My argument is not about Africans being able to eat fish out of necessity, ... All this global change is garbage when there are many ...
    (uk.local.kent)