1
我真的厭倦了訪問和它的奇怪的SQL語法,我瀏覽過谷歌和StackOverflow,我發現提示,但我無法設法讓我的大查詢工作......我只是有多個左外連接,我不能安排在括號內,讓它接受這個該死的訪問...多個OUTER JOIN
你能給我一個暗示我的連接有什麼問題嗎?爲什麼訪問抱怨:「JOIN SYNTAX錯誤」
真的很感謝您!
Miloud
SELECT ORDR.*, ITEM.*, ERAS.*, MAPP.New, KUMV.*
FROM ((GEN_ORDERS AS ORDR)
LEFT OUTER JOIN
(
(SELECT concat,ORDER_NUM, ConTY1 AS CT, ConValue1 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY2 AS CT, ConValue2 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY3 AS CT, ConValue3 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY4 AS CT, ConValue4 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY5 AS CT, ConValue5 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY6 AS CT, ConValue6 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY7 AS CT, ConValue7 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY8 AS CT, ConValue8 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY9 AS CT, ConValue9 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY10 AS CT, ConValue10 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY11 AS CT, ConValue11 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY12 AS CT, ConValue12 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY13 AS CT, ConValue13 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY14 AS CT, ConValue14 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY15 AS CT, ConValue15 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY16 AS CT, ConValue16 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY17 AS CT, ConValue17 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY18 AS CT, ConValue18 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY19 AS CT, ConValue19 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY20 AS CT, ConValue20 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY21 AS CT, ConValue21 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY22 AS CT, ConValue22 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY23 AS CT, ConValue23 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY24 AS CT, ConValue24 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY25 AS CT, ConValue25 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY26 AS CT, ConValue26 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY27 AS CT, ConValue27 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY28 AS CT, ConValue28 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY29 AS CT, ConValue29 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY30 AS CT, ConValue30 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY31 AS CT, ConValue31 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY32 AS CT, ConValue32 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY33 AS CT, ConValue33 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY34 AS CT, ConValue34 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY35 AS CT, ConValue35 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY36 AS CT, ConValue36 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY37 AS CT, ConValue37 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY38 AS CT, ConValue38 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY39 AS CT, ConValue39 AS CV FROM GEN_ITEMS UNION ALL
SELECT concat,ORDER_NUM, ConTY409 AS CT, ConValue40 AS CV FROM GEN_ITEMS) AS ITEM)
ON ORDR.ORDER_NUM = ITEM.ORDER_NUM
)
LEFT OUTER JOIN GEN_ERASALES AS ERAS ON ITEM.concat = ERAS.concat
LEFT OUTER JOIN MAPPING AS MAPP ON ITEM.CT = MAPP.Old
LEFT OUTER JOIN GEN_KUMV KUMV ON ERAS.DOCCOND = KUMV.KNUMV AND MAPP.New = KUMV.KSCHL
請在您的問題中包含代碼,而不是通過外部鏈接,以便問題可以獨立存在。 – Donnie 2010-12-08 15:36:14
你可以用gui界面調整連接嗎? – Keng 2010-12-08 15:36:47