当前位置:Gxlcms > mssql > insertintotbl()select*fromtb2中加入多个条件

insertintotbl()select*fromtb2中加入多个条件

时间:2021-07-01 10:21:17 帮助过:42人阅读

代码如下:

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

您可能感兴趣的文章:

  • 数据库插入数据之select into from与insert into select区别详解
  • insert into select和select into的使用和区别介绍
  • 解析MySQL中INSERT INTO SELECT的使用
  • SELECT INTO 和 INSERT INTO SELECT 两种表复制语句简单介绍
  • INSERT INTO SELECT语句与SELECT INTO FROM语句的一些区别
  • insert select与select into 的用法使用说明
  • mssql insert into 和insert into select性能比较
  • select into 和 insert into select 两种表复制语句
  • SELECT INTO 和 INSERT INTO SELECT 两种表复制语句详解(SQL数据库和Oracle数据库的区别)

人气教程排行