台灣最大程式設計社群網站
線上人數
1246
 
會員總數:245251
討論主題:189111
歡迎您免費加入會員
討論區列表 >> Oracle >> 兩種不同資料如何合併SQL
[]  
[我要回覆]
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
兩種不同資料如何合併SQL
價值 : 5 QP  點閱數:225 回應數:0

樓主

dean
門外漢
0 1
16 0
發送站內信

(SELECT
A.WORK_ORDER,
A.PALLET_NO,
A.SERIAL_NUMBER,
B.PROCESS_NAME,
'10'AS STEP,
'QC CODE'AS ACTION,
case
when A.PROCESS_ID=C.PROCESS_ID or A.PROCESS_ID=F.RP_PROCESS_ID then E.DEFECT_CODE
else 'PASS'
end as "DEFECT_CODE",
A.OUT_PROCESS_TIME "OutProcessTime",
case
when A.PROCESS_ID=C.PROCESS_ID or A.PROCESS_ID=F.RP_PROCESS_ID then NVL(F.REMARK,SAJET.sj_get_repair_remark(F.RECID))
else null
end as "備註(Remark/Defect Item)",
case
when A.PROCESS_ID=F.RP_PROCESS_ID then F.REPAIR_TIME
else null
end as "(Repair Time)",
Case
when A.PROCESS_ID=C.PROCESS_ID or A.PROCESS_ID=F.RP_PROCESS_ID then G.REASON_CODE
else null
end as "原因代碼(Reason Code)",
case
when A.PROCESS_ID=C.PROCESS_ID or A.PROCESS_ID=F.RP_PROCESS_ID then G.REASON_DESC
else null
end as "原因描述(Reason Desc)",
case
when A.PROCESS_ID=C.PROCESS_ID or A.PROCESS_ID=F.RP_PROCESS_ID then F.LOCATION
else null
end as "位置(Location)"
FROM SAJET.G_SN_TRAVEL A,
SAJET.SYS_PROCESS B ,SAJET.G_SN_DEFECT C , SAJET.SYS_DEFECT E, SAJET.G_SN_REPAIR F, SAJET.SYS_REASON G, SAJET.SYS_DUTY H
WHERE A.PROCESS_ID = B.PROCESS_ID
AND A.SERIAL_NUMBER=C.SERIAL_NUMBER
AND E.DEFECT_ID=C.DEFECT_ID
AND F.RECID=C.RECID
AND F.REASON_ID=G.REASON_ID
AND F.DUTY_ID=H.DUTY_ID
AND B.PROCESS_ID NOT IN '100056'
AND A.SERIAL_NUMBER ='IXJ146088')aa 無資料 ,因為沒有經過包裝跟維修倉

(SELECT
A.WORK_ORDER,
A.PALLET_NO,
A.SERIAL_NUMBER,
B.PROCESS_NAME,
'10'AS STEP,
C.BARCODE AS ACTION
FROM SAJET.G_SN_TRAVEL A,SAJET.SYS_PROCESS B , SAJET.G_BARCODE C
WHERE A.PROCESS_ID = B.PROCESS_ID
AND A.SERIAL_NUMBER = C.SERIAL_NUMBER
AND A.PROCESS_ID ='100056'
AND A.SERIAL_NUMBER ='IXJ146088')bb有資料

請問一下,如何aa跟bb資料兩個合併顯示下列欄位

WORK_ORDER PALLET_NO SERIAL_NUMBER PROCESS_NAME STEP ACTION DEFECT_CODE OutProcessTime 備註(Remark/Defect Item) (Repair Time) 原因代碼(Reason Code) 原因描述(Reason Desc) 位置(Location)
100S-209104 N/A IXJ146088 TOP PACKING 10 00155C422867



搜尋相關Tags的文章: [ 兩種不同資料如何合併SQL ] ,
本篇文章發表於2019-03-14 09:04
別忘捐VP感謝幫助你的人 新手會員瞧一瞧
目前尚無任何回覆
   

回覆
如要回應,請先登入.