hi,
I have a logfile which logs the insert/delete/updates from all kinds of tables. I would like to get an overview of for example the last 20 people which records where updated, ordered by the last update datetime DESC
What I have now is:
SELECT DISTINCT logfile.idvalue, DATE_FORMAT(logfile.logDateTime,'%d-%m-%Y %H:%i') AS thedatetime, CONCAT_WS(' ',people.peopleSurname,people.peopleLastname) AS peopleName
FROM logfile,people
WHERE 0=0
AND logfile.tablename='people'
AND logfile.action='update'
AND logfile.idvalue=people.peopleID
GROUP BY logfile.idvalue
ORDER BY logfile.logDateTime DESC,logfile.idvalue DESC
But this results in logDateTimes which don't correspond to the datetime of the latest (Max) "update-entry" What am i missing?!
thanks Bart