ms_dos

  博客园  :: 首页  :: 新随笔  ::  :: 订阅 订阅  :: 管理

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表其它的字段应该可以为空

posted on 2007-06-27 20:55  ms_dos  阅读(328)  评论(0)    收藏  举报