【发布时间】:2010-08-24 19:28:01
【问题描述】:
我有一个日志文件,它记录来自各种表的插入/删除/更新。 我想了解例如最近 20 个人的概述,这些人记录了更新的位置,按上次更新日期时间 DESC 排序
我现在拥有的是:
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
但这会导致 logDateTimes 与最新(最大)“更新条目”的日期时间不对应 我错过了什么?!
谢谢 巴特
【问题讨论】: