我試圖在三個不同的數據庫中的三個表上運行查詢。這個查詢的工作原理,但我拉近十億條記錄...是否有任何解決方案從以下查詢中抽取smlog.requestor_type和arcust.maj_class的不同字段?跨三個數據庫的SQL三聯左連接查詢
SELECT
smreq.request_id AS ROIrequestID,
arcust.customer AS LAWcustID,
smlog.logid AS ESLlogID,
arcust.maj_class AS invoicetype,
smlog.requestor_type AS SMLrequestortype,
smlog.request_type as SMLrequesttype
FROM roi.sm_request_sp_data reqsp
LEFT JOIN [email protected] smlog ON smlog.logid = reqsp.logid
LEFT JOIN roi.sm_requests smreq ON smreq.request_id = reqsp.request_id
LEFT JOIN [email protected] arcust ON arcust.customer =
smreq.customer_id
WHERE smreq.ORIG_DT >= TO_DATE('2016/03/01', 'yyyy/mm/dd')
AND smreq.ORIG_DT <= TO_DATE('2016/03/02','yyyy/mm/dd')
GROUP BY smlog.requestor_type;
向我們展示db架構,示例數據,當前和預期輸出。 \t請閱讀[**如何提問**](http://stackoverflow.com/help/how-to-ask) \t \t這裏是一個偉大的地方[** START **] (http://spaghettidba.com/2015/04/24/how-to-post-at-sql-question-on-a-public-forum/)來了解如何提高您的問題質量並獲得更好的答案。 \t [**如何創建一個最小的,完整的,並且可驗證例如**](http://stackoverflow.com/help/mcve) \t嘗試創建一個樣品中http://rextester.com –
是你的問題現在解決了?你仍然有關於這個答案的問題嗎?要接受答案「[**點擊Tick **](https://ibb.co/ikqyO6)」以獲取更多信息,請參閱[help/accepting](https://stackoverflow.com/help/someone-answers)* *每次接受都會獲得2個聲望點** –