纠结的SQL

今天要查出一个统计列表,但又有时间条件,条件就是最后更新的一次为准确值,结果就冒出这么一段SQL出来了。还好,结果符合要求。

SELECT `dg`.`aid` ,`dg`.`title`,`dg`.`senddate`,`dg`.`mid`,`df`.`dtime` FROM `_addonlog` as `dg` LEFT JOIN `_feedback` as `df` on `dg`.`aid` = `df`.`aid` AND `dg`.`mid` = '88' Group by `df`.`aid` ORDER BY MAX(`df`.`dtime`)  DESC 

Leave a Reply

(will not be published)