A左关联B,取从B表多条记录取一条

select * from a 
left join b on a.ID = b.ID
where not exists (select 1 from b t where t.ID = b.ID and t.TimeEnd > b.TimeEnd)

posted on 2011-12-13 10:05  滴d  阅读(716)  评论(0编辑  收藏  举报

导航