0
我在我的數據庫中有兩個像下面這樣的表。在evry DEPARTMENT_CODE的第一個ITEM項目中,會有多個ITEM_CODE。Oracle多重更新查詢
ITEM
----------------------------------------------------
"STORE_CODE" "ITEM_CODE" "DEPARTMENT_CODE"
"011" "912003" "14"
"011" "912004" "14"
"011" "914001" "14"
----------------------------------------------------
COMPETITOR
--------------------------------------------------------------
"STORE_CODE" "ITEM_CODE" "DEPARTMENT_CODE" "COMPETITOR_CODE"
"011" "912003" "14" "01"
"011" "912003" "14" "02"
"011" "912003" "14" "03"
"011" "912004" "14" "01"
"011" "912004" "14" "02"
"011" "912004" "14" "04"
"011" "914001" "14" "01"
"011" "914001" "14" "02"
"011" "914001" "14" "03"
-------------------------------------------------------------
在表COMPETITOR埃維ITEMCODE將有三個條目,並具有該
不同competitor_Code我有三個值COMP_1,comp_2,comp_3和department_code = 14;
我想做的事是COMP_1,comp_2,comp_3對於埃夫裏ITEM_CODE這ITEM表已department_code 14個更新COMPETITOR表
樣本輸出
COMPETITOR
--------------------------------------------------------------
"STORE_CODE" "ITEM_CODE" "DEPARTMENT_CODE" "COMPETITOR_CODE"
"011" "912003" "14" "Comp_1"
"011" "912003" "14" "Comp_2"
"011" "912003" "14" "Comp_3"
"011" "912004" "14" "Comp_1"
"011" "912004" "14" "Comp_2"
"011" "912004" "14" "Comp_3"
"011" "914001" "14" "Comp_1"
"011" "914001" "14" "Comp_2"
"011" "914001" "14" "Comp_3"
-------------------------------------------------------------
我怎麼能寫一個Oracle查詢這個?
您正在使用解碼(department_code,'01','Comp_1','02' ,'Comp_2','03','Comp_3')。但在我的情況下,我不知道'01','02','03'會帶來什麼樣的價值。它可能是任何東西。唯一的問題是每個項目會有三個條目 – Andromeda 2010-06-22 07:36:34
@Jasim - 如果您希望我們提供幫助,您應該提前向我們提供所有相關信息。 – APC 2010-06-22 09:56:34