日期:2014-05-18 浏览次数:20697 次
select [hwbh],isnull(a.dshk,0) as dshk from (
select ROW_NUMBER()over(partition by [jydbh]
order by [hwbh]) as id,* from [D表]
)t
left join (select ROW_NUMBER()over(partition by [jydbh]
order by [dshk]) as id,* from [C表]
)a on t.id=a.id and t.jydbh=a.jydbh