[AccessD] Last Date Query

David McAfee davidmcafee at gmail.com
Thu Dec 22 16:02:59 CST 2011


Nothing, I think that would work, and would also return more than one
record as my suggestion would, if there were indeed more than one record on
that max date.

D

On Thu, Dec 22, 2011 at 1:49 PM, William Benson <vbacreations at gmail.com>wrote:

> Since now two posts have been made since I offered my idea that what was
> really wanted was Max.... and neither commented one way or another on my
> query .... what was incorrect about how I did it?
> On Dec 22, 2011 3:22 PM, "Steve Schapel" <
> steve at datamanagementsolutions.biz>
> wrote:
>
> > Agreed.  Assuming you mean the most recent date, i.e. Max rather than
> > Last, then Arthur's suggestion is how I would do it.
> >
> > Regards
> > Steve
> >
> > -----Original Message----- From: Arthur Fuller
> > Sent: Friday, December 23, 2011 1:05 AM
> > To: Access Developers discussion and problem solving
> > Subject: Re: [AccessD] Last Date Query
> >
> > I think what you want is this:
> >
> > SELECT TOP 1 tbl1.Pat, tbl1.Date AS LastDate, tbl1.Result
> > FROM tbl1
> > ORDER BY tbl1.Date DESC;
> >
> > HTH,
> > Arthur
> >
> > On Thu, Dec 22, 2011 at 7:35 AM, <pedro at plex.nl> wrote:
> >
> >
> >> Hello Group, i want the last dat from tbl1
> >>
> >> Pat     Date       Result
> >> A1     01-01-11    15
> >> A1     10-10-11     7
> >> A1     11-11-11     6
> >>
> >> When i use the query:
> >>
> >> SELECT tbl1.Pat, Last(tbl1.Date) AS LastDate, tbl1.Result
> >> FROM tbl1
> >> GROUP BY tbl1.Pat, tbl1.Result;
> >>
> >> Then is stil have these three records because of the Result
> >>
> >> What i need is only record that is really the last date, regardless what
> >> value there is for result
> >>
> >> Pat     LastDate         Result
> >> A1     11-11-11           6
> >>
> >>
> >> I have done this before, but i can't remember how.
> >> Is has to been done with a subquery.
> >>
> >> Who can help me?
> >>
> >> Thanks
> >>
> >> Pedro
> >> --
> >>
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/**mailman/listinfo/accessd<
> http://databaseadvisors.com/mailman/listinfo/accessd>
> > Website: http://www.databaseadvisors.**com<
> http://www.databaseadvisors.com>
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list