SELECT
DISTINCT t.*
FROM
( SELECT job_name, max( id ) AS id FROM t_file_sync_result GROUP BY job_name ) a
LEFT JOIN
t_file_sync_result t ON t.job_name = a.job_name
AND t.id = a.id and t.job_config_type <> 2
注意:数据量较大的情况下,把聚合字段添加查询索引,然会很慢,如id