MySQL多表联查获取最新数据

SELECT *
FROM task a, 
    (SELECT id,
         name,
         addtime
    FROM task_step j, 
        (SELECT id,
         name,
         max(addtime) addtime
        FROM task_step
        GROUP BY  id) q
        WHERE j.id=q.id
                AND j.addtime=q.addtime)
    WHERE a.id=b.id

 

posted @ 2022-07-01 11:28  Liu66~  阅读(534)  评论(0编辑  收藏  举报