Sid3335
05-02-2006, 05:47 AM
Hi:
I have 2 records in my database:
they have the following fields:
EnqID, Actions, Date
the EnqID is the same (1), the actions and date are different.
i want to return the Actions and Date. But only on the latest date.
so i tried:
SELECT Actions,
Max(STR_TO_DATE(`Date`,'%d/%m/%Y')) AS `lastDate`
FROM Progress
WHERE EnqID = 1
Group By EnqID
this gives me the correct date that i want but not the action, it is in fact the date from the second record and the action from the first.
I've tried many variations but i can't get it to work.
Can anyone tell me the problem? Thanks Guys
I have 2 records in my database:
they have the following fields:
EnqID, Actions, Date
the EnqID is the same (1), the actions and date are different.
i want to return the Actions and Date. But only on the latest date.
so i tried:
SELECT Actions,
Max(STR_TO_DATE(`Date`,'%d/%m/%Y')) AS `lastDate`
FROM Progress
WHERE EnqID = 1
Group By EnqID
this gives me the correct date that i want but not the action, it is in fact the date from the second record and the action from the first.
I've tried many variations but i can't get it to work.
Can anyone tell me the problem? Thanks Guys