Tried it but doesn't seem to do it. This was the direction I was going in,
but it just seems to return all items like my original query.
Any more suggestions?
> > ID SDate TenantID State Parm Notes
> > 1322 19/09/2005 13:52:29 MRC Raise T1 0 Man: £2200,L141
[quoted text clipped - 8 lines]
> >
> >I'm trying to get a query that returns the Maximum of each type of TenantID from this table. I've tried Max, Last on the ID and SDate without
success. Variants being:
> >Criterion: ID = Max([ID])
> >Criterion: SDate = Max([SDate])
> >
> >Within:
> >
> >SELECT DISTINCTROW Max(ArrearsStatus.ID) AS MaxOfID, ArrearsStatus.SDate, ArrearsStatus.TenantID, ArrearsStatus.State, ArrearsStatus.Notes,
ArrearsStatus.Parm
> >FROM ArrearsStatus
> >GROUP BY ArrearsStatus.SDate, ArrearsStatus.TenantID, ArrearsStatus.State, ArrearsStatus.Notes, ArrearsStatus.Parm
[quoted text clipped - 16 lines]
> WHERE M.ID = A.ID)
> ORDER BY A.SDate, A.TenantID
giorgio rancati - 19 Sep 2005 20:21 GMT
Hi Barry,
you do a small correction to the query
----
SELECT A.ID, A.SDate, A.TenantID, A.State, A.Notes, A.Parm
FROM ArrearsStatus As A
WHERE A.SDate = (SELECT Max(M.SDate)
FROM ArrearsStatus As M
WHERE M.TenantID = A.TenantID)
----
Bye Giorgio
> Tried it but doesn't seem to do it. This was the direction I was going in,
> but it just seems to return all items like my original query.
>
> Any more suggestions?
[CUT]
> > A group by query wont find specific records, it will only
> > aggregate like values.
[quoted text clipped - 7 lines]
> > WHERE M.ID = A.ID)
> > ORDER BY A.SDate, A.TenantID
Marshall Barton - 19 Sep 2005 20:28 GMT
Good catch giorgio.

Signature
Marsh
MVP [MS Access]
>you do a small correction to the query
>----
[quoted text clipped - 22 lines]
>> > WHERE M.ID = A.ID)
>> > ORDER BY A.SDate, A.TenantID
Barry - 19 Sep 2005 20:31 GMT
Yep, that did it!
Thanks guys.
> Hi Barry,
>
[quoted text clipped - 26 lines]
> > > WHERE M.ID = A.ID)
> > > ORDER BY A.SDate, A.TenantID