日期:2014-05-18 浏览次数:20491 次
select a.filesname,a.fname,a.jiedian,b.bzyj,b.shyj,b.qfyj from tb_A as a left join tb_B as b on a.id=b.bianhao where a.id=@id and b.id=(select id from tb_B where bianhao=@id and version=(select max(version) from tb_B where bianhao=@id))
select a.filesname,a.fname,a.jiedian,b.bzyj,b.shyj,b.qfyj from tb_A as a left join tb_B as b on a.id=b.bianhao and not exists(select 1 from tb_b where bianhao=b.bianhao and version>b.version) where a.id=@id