22,209
社区成员
发帖
与我相关
我的任务
分享
select distinct a.keyjobno,a.name,getdate,b.indate,b.createdate,c.escdate,d.activityname,joindate
from welfare a
left join in_union_his b on a.keyjobno=b.keyjobno
left join esc_union_his c on a.keyjobno=c.keyjobno
left join activityrecord d on a.keyjobno=d.keyjobno
select * from welfare a
inner join in_union_his b
on a.key_jobno =b.key_jobno
left join esc_union_his c
on b.id=c.id
left join activityrecord d
on c.id=d.id
SELECT a.keyjobno ,
a.name ,
getdate ,
b.indate ,
b.createdate ,
c.escdate ,
d.activityname ,
joindate
FROM welfare a
INNER JOIN in_union_his b ON a.keyjobno = b.keyjobno
LEFT JOIN esc_union_his c ON a.keyjobno = c.keyjobno
AND B.ID = C.ID
LEFT JOIN activityrecord d ON a.keyjobno = d.keyjobno
AND B.ID = D.ID
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