加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQL Server insert into tbl() select * from tb2中加入多个条件

发布时间:2020-12-12 07:52:05 所属栏目:MsSql教程 来源:网络整理
导读:感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编两巴掌来看看吧! 代码如下: insert into warehouse(wlbm,wlmc,ys,wlgg,sybm,wlfl) select * from (select rtrim(b.bjbm) as bjbm,a.bjmc as wlmc,a.ys,a.clgg as wlgg,a.bm,(case a.bm when 注塑 then 2

感兴趣的小伙伴,下面一起跟随编程之家 52php.cn的小编两巴掌来看看吧!

代码如下:


insert into warehouse(wlbm,wlmc,ys,wlgg,sybm,wlfl) select * from (select rtrim(b.bjbm) as bjbm,a.bjmc as wlmc,a.ys,a.clgg as wlgg,a.bm,(case a.bm when '注塑' then 2 
when '吹塑' then 43 
when '搪胶' then 3 
when '喷油' then 4 
when '车梳' then 45 
when '冲压' then 19 
when '电焊' then 31 
when '烤漆' then 37 
when '裁床' then 38 

when '丝印' then 46 
when '车缝' then 39 
when '装配' then 40 
when '包装' then 42 

end) as wlfl 
FROM (select distinct(rtrim(bjbm)) as bjbm from dbo.CP_LB where bjbm<>'' and bjbm not in (select wlbm from warehouse)) b left JOIN dbo.CP_LB a 
on rtrim(b.bjbm)=rtrim(a.bjbm)) c 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读