SELECT a.sat_orderclueid, b.logtype,b.content,b.createby,b.createdate from ( SELECT sat_orderclueid, Max(createdate) createdate from sat_ordercluefollowuplog WHERE siteid = $siteid$ and sat_orderclueid in $sat_orderclueid$ GROUP BY sat_orderclueid) a LEFT JOIN sat_ordercluefollowuplog b ON a.createdate = b.createdate WHERE b.siteid = $siteid$