日期:2014-05-17 浏览次数:20705 次
select a.keyjobno,a.name,getdate,b.indate,b.createdate,c.escdate,d.activityname,joindate
from (select *,rn=ROW_NUMBER()over(partition by keyjobno order by getdate()) from in_union_his) a
left join (select *,rn=ROW_NUMBER()over(partition by keyjobno order by getdate()) from welfare) b on a.keyjobno=b.keyjobno and a.rn=b.rn
left join (select *,rn=ROW_NUMBER()over(partition by keyjobno order by getdate()) from esc_union_his) c on a.keyjobno=c.keyjobno and a.rn=c.rn
left join (select *,rn=ROW_NUMBER()over(partition by keyjobno order by getdate()) from activityrecord) d on a.keyjobno=d.keyjobno and a.rn=d.rn
SELECT a.keyjobno ,
a.name ,
getdate ,
b.indate ,
b.createdate ,
c.escdate ,
d.activityname ,
joindate
FROM welfare a