Outer joins with more than 2 Tables - MSQuery

kgkev

Well-known Member
Joined
Jun 24, 2008
Messages
1,291
Office Version
  1. 365
Platform
  1. Windows
I want to return some data from a SQL Table.

I have an Order number that brings back List of item Numbers from the order table (opdetm).

This looks at the Stock Table (stockm) and returns a supplier code.

This then looks at the supplier table (plsuppm) and returns the Address Details.

however Sometimes The Item number "Supplier" field will be blank (ie made in house)

With my current Query these items are missed off. I think this is the difference with an outer and an inner join?

Is there any way I can change my SQL code to return all values from opdetm, even when stockm.supplier is blank?

Code:
SELECT opdetm.order_line_no, opdetm.product, opdetm.description, stockm.supplier, plsuppm.name, plsuppm.address1, plsuppm.address2, plsuppm.address3, plsuppm.address4, plsuppm.address5
FROM ihwt.scheme.opdetm opdetm, ihwt.scheme.plsuppm plsuppm, ihwt.scheme.stockm stockm
WHERE opdetm.product = stockm.product AND opdetm.warehouse = stockm.warehouse AND plsuppm.supplier = stockm.supplier AND ((opdetm.order_no=?))
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top