query with Max(Date)

M

Mario Krsnic

Hello everybody,
I have the query:

SELECT personen.Familienname, personen.Vorname, Diagnose, Evaldatum,
perspflege2.lfd_nr
FROM (perspflege2 INNER JOIN personen ON personen.lfd_nr=perspflege2.lfd_nr)
INNER JOIN diageval ON diageval.id=perspflege2.id
WHERE last(diageval.myDate) = 2/2/2008;

The Access tells me, this is not possible. How to make the query with the
last (greatest) Date from the tabel DiagEval.
Thank you for your help.
Mario
 
J

John Spencer

Perhaps the following is what you want.


SELECT personen.Familienname
, personen.Vorname
, Diagnose
, Evaldatum
, perspflege2.lfd_nr
FROM (perspflege2 INNER JOIN personen ON
personen.lfd_nr=perspflege2.lfd_nr) INNER JOIN diageval
ON diageval.id=perspflege2.id
GROUP BY personen.Familienname
, personen.Vorname
, Diagnose
, Evaldatum
, perspflege2.lfd_nr
HAVING MAX(Diageval.myDate) = #2008-02-02#


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
M

Mario Krsnic

Yes, John, thank you!

John Spencer said:
Perhaps the following is what you want.


SELECT personen.Familienname
, personen.Vorname
, Diagnose
, Evaldatum
, perspflege2.lfd_nr
FROM (perspflege2 INNER JOIN personen ON
personen.lfd_nr=perspflege2.lfd_nr) INNER JOIN diageval
ON diageval.id=perspflege2.id
GROUP BY personen.Familienname
, personen.Vorname
, Diagnose
, Evaldatum
, perspflege2.lfd_nr
HAVING MAX(Diageval.myDate) = #2008-02-02#


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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