G
Guest
Hello,
I try to extract the latest date from a table "Test_date", having a Text
field "creationdate" containing dates (format dd/mm/yyyy) :
creationdate
26/01/2007
22/01/2007
15/01/2007
07/01/2007
31/12/2006
23/12/2006
30/11/2006
My query looks like :
SELECT Max(test_date.creationdate) AS MaxOfcreationdate FROM test_date;
The outcome is "31/12/2006", which is wrong because it should be "26/01/2007".
To retrieve "26/01/2007", I changed my query as follow :
SELECT test_date.creationdate, Right([creationdate],4) &
Mid([creationdate],4,2) & Left([creationdate],2) AS last_date
FROM test_date
ORDER BY Right([creationdate],4) & Mid([creationdate],4,2) &
Left([creationdate],2) DESC;
This query actually doesn't extract the latest date (max), it just sorts the
"last_date", in descending order.
I'd like to group the outcome like this :
SELECT test_date.creationdate, Max(Right([creationdate],4) &
Mid([creationdate],4,2) & Left([creationdate],2)) AS last_date
FROM test_date;
but it doesn't work !
Should I use a subquery or something ?
I know I could do the job with 2 queries, but I wonder if there is a way to
do it with one.
I hope my explanations are clear enough.
thx in advance for any help,
Nicodemus
I try to extract the latest date from a table "Test_date", having a Text
field "creationdate" containing dates (format dd/mm/yyyy) :
creationdate
26/01/2007
22/01/2007
15/01/2007
07/01/2007
31/12/2006
23/12/2006
30/11/2006
My query looks like :
SELECT Max(test_date.creationdate) AS MaxOfcreationdate FROM test_date;
The outcome is "31/12/2006", which is wrong because it should be "26/01/2007".
To retrieve "26/01/2007", I changed my query as follow :
SELECT test_date.creationdate, Right([creationdate],4) &
Mid([creationdate],4,2) & Left([creationdate],2) AS last_date
FROM test_date
ORDER BY Right([creationdate],4) & Mid([creationdate],4,2) &
Left([creationdate],2) DESC;
This query actually doesn't extract the latest date (max), it just sorts the
"last_date", in descending order.
I'd like to group the outcome like this :
SELECT test_date.creationdate, Max(Right([creationdate],4) &
Mid([creationdate],4,2) & Left([creationdate],2)) AS last_date
FROM test_date;
but it doesn't work !
Should I use a subquery or something ?
I know I could do the job with 2 queries, but I wonder if there is a way to
do it with one.
I hope my explanations are clear enough.
thx in advance for any help,
Nicodemus