日期:2014-05-18 浏览次数:20554 次
select m.* , n.* from tb1 m , tb2 n where m.detailsid = n.detailsid and n.chrimage = (select top 1 chrimage from tb2 where liveid = n.liveid order by chrimage) select m.* , n.* from tb1 m , tb2 n where m.detailsid = n.detailsid and n.chrimage = (select top 1 chrimage from tb2 where liveid = n.liveid order by chrimage desc) select m.* , n.* from tb1 m , tb2 n where m.detailsid = n.detailsid and n.chrimage = (select min(chrimage) from tb2 where liveid = n.liveid) select m.* , n.* from tb1 m , tb2 n where m.detailsid = n.detailsid and n.chrimage = (select max(chrimage) from tb2 where liveid = n.liveid) select m.* , n.* from tb1 m , tb2 n where m.detailsid = n.detailsid and not exists (select 1 from tb2 where liveid = n.liveid and chrimage < n.chrimage) select m.* , n.* from tb1 m , tb2 n where m.detailsid = n.detailsid and not exists (select 1 from tb2 where liveid = n.liveid and chrimage > n.chrimage)