insert into bj(bjdh)
select distinct substring(id,1,8) as bjdh
from student
where substring(id,1,1)!='P'
union
select distinct substring(id,1,9) as bjdh
from student
where substring(id,1,1)='P'


insert into bj(bjdh)
select distinct left(id,len(id)-2) as bjdh
from student


insert into bj(bjdh,bjmc)
select distinct left(id,len(id)-2) as bjdh,zymc+right(left(id,len(id)-2),4) as bjmc
from student,zy
where left(id,len(id)-6)=zydh


insert into bj(bjdh,bjmc)
select distinct left(id,len(id)-2) as bjdh,zymc+right(left(id,len(id)-2),4) as bjmc
from student,zy
where substring(id,len(id)-5,2)='07' and left(id,len(id)-6)=zydh

注意:bj表其它的字段应该可以为空

相关文章:

  • 2021-10-12
  • 2021-06-29
  • 2021-11-07
  • 2022-12-23
  • 2021-12-27
  • 2021-08-12
  • 2022-12-23
  • 2021-08-17
猜你喜欢
  • 2022-12-23
  • 2021-05-05
  • 2022-03-01
  • 2021-07-28
  • 2021-07-13
  • 2022-02-13
  • 2022-12-23
相关资源
相似解决方案