Why Toad turned my LEFT OUTER JOIN into a RIGHT OUTER JOIN
-1
votes
2
answers
1312
views
I finally figured out the answer but it might be useful for someone looking up the same question so here is the whole write up to hopefully save you the frustration.
Problem I had:
Toad's query builder has 3 tabs - Diagram, Query and Results.
I adjusted my query to what I wanted in Query tab. Ran it and confirmed that Results tab looked good. Then, I wanted to sync Query to Diagram. After syncing I noticed that my LEFT OUTER JOIN was turned into a RIGHT OUTER JOIN.
Why? Won't the results be wrong?
I wanted all records from INVOICES table and only matching records from INVOICE_ITEMS table.
My original query's FROM statement was:
FROM INVOICES
LEFT OUTER JOIN INVOICE_ITEMS
ON (INVOICE_ITEMS.INVOICE_GKEY = INVOICES.GKEY)
And Toad kept turning it into:
FROM INVOICES
RIGHT OUTER JOIN INVOICE_ITEMS
ON (INVOICE_ITEMS.INVOICE_GKEY = INVOICES.GKEY)
It was driving me crazy. Why was it doing that?
Well, the solution was simple. I apparently **reversed my tables** and Toad was smart enough to fix it for me. *(Facepalm)* I'm still not sure if it's a good feature or not considering my confusion but it's definitely there.
So, the correct syntax for LEFT OUTER JOIN was supposed to be:
FROM INVOICES
LEFT OUTER JOIN INVOICE_ITEMS
ON (INVOICES.INVOICE_GKEY = INVOICE_ITEMS.GKEY)
Asked by Kamiccola
(1 rep)
Apr 11, 2018, 07:17 PM
Last activity: Apr 7, 2019, 07:00 PM
Last activity: Apr 7, 2019, 07:00 PM