子工单开工完工日期与母工单同步 Oracle SQL

转载请注明出处,联系我: [email protected]
本人热衷于数据库技术及算法的研究,志同道合之士, 欢迎探讨

 update sfb_file t1 set(sfb13,sfb15)=(select sfb13,sfb15 from sfb_file t2 where t1.sfb86=t2.sfb01)
 where t1.sfb01 in(select sfb01
 from ( select sfb_file.sfb01,sfb_file.sfb04,sfb_file.sfb13,sfb_file.sfb15
 ,sfb_file.sfb86,a1.sfb13,a1.sfb15,a1.sfb04 
 from sfb_file,( select sfb01,sfb04,sfb13,sfb15 from sfb_file 
 where (substr(sfb01,2,3)='510' or substr(sfb01,2,3)='516') and sfb04<>8) a1
 where substr(sfb_file.sfb01,2,3)='512' and sfb_file.sfb04<>8
 and sfb_file.sfb86=a1.sfb01 and (sfb_file.sfb13<>a1.sfb13 or sfb_file.sfb15<>a1.sfb15)));

你可能感兴趣的:(子工单开工完工日期与母工单同步 Oracle SQL)