我有這兩個表如下,我需要更新Table1.Active_flag
到Y
,其中Table2.Reprocess_Flag
是N
。更新oracle與加入兩個表
表1
+--------+--------------+--------------+--------------+-------------+
| Source | Subject_area | Source_table | Target_table | Active_flag |
+--------+--------------+--------------+--------------+-------------+
| a | CUSTOMER | ADS_SALES | ADS_SALES | N |
| b | CUSTOMER | ADS_PROD | ADS_PROD | N |
| CDW | SALES | CD_SALES | CD_SALES | N |
| c | PRODUCT | PD_PRODUCT | PD_PRODUCT | N |
| d | PRODUCT | PD_PD1 | PD_PD1 | N |
| e | ad | IR_PLNK | IR_PLNK | N |
+--------+--------------+--------------+--------------+-------------+
表2
| Source | Subject_area | Source_table | Target_table | Reprocess_Flag |
+--------+--------------+--------------+--------------+----------------+
| a | CUSTOMER | ADS_SALES | ADS_SALES | N |
| b | CUSTOMER | ADS_PROD | ADS_PROD | N |
| CDW | SALES | CD_SALES | CD_SALES | N |
| c | PRODUCT | PD_PRODUCT | PD_PRODUCT | Y |
| d | PRODUCT | PD_PD1 | PD_PD1 | Y |
| e | ad | IR_PLNK | IR_PLNK | N |
+--------+--------------+--------------+--------------+----------------+
您的問題不可讀。 – FDavidov
你有試過什麼嗎?發佈您的代碼,請 – Aleksej
UPDATE hdfs_cntrl SET active_flag = 'Y' 其中源(來自proc_cntrl選擇源,其中Reprocess_Flag = 'N') 和subject_area中(選擇proc_cntrl subject_area其中Reprocess_Flag = 'N') 和source_table在(從proc_cntrl中選擇target_table,其中Reprocess_Flag ='N'); –