通过mysql分组获取分组后的最新数据 SELECT IFNULL((SELECT t2.column FROM table2 t2 where t2.f_id=t.id),0) as column FROM( SELECT MAX(f_id) as id FROM table1 t1 GROUP BY t1.column ORDER BY t1.f_id DESC )t;