程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> 其他數據庫知識 >> 更多數據庫知識 >> insert into tbl() select * from tb2中加入多個條件

insert into tbl() select * from tb2中加入多個條件

編輯:更多數據庫知識

復制代碼 代碼如下:
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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved