I need some help trying to figure out how to retrieve data from 3 different tables, when there are records in 1 table that don't exists in the other tables.
Here's the situation
Table1
Fields: RefNum & PartNum
In this table there may be multiple PartNum associated with a RefNum
Ex:
RefNum | PartNum
4-1 | ABC
4-1 | DEF
4-2 | AAA
4-3 | BBB
Table2
Fields PartNum, NewPartNum
The PartNum will match up to Table1.PartNum although there may not be a match at all
Ex:
PartNum | NewPartNum
ABC | 123
AAA | 999
BBB | 888
Table3
Fields PartNum, Price
This PartNum will also match up to Table2.NewPartN um
Ex:
PartNum | Price
123 | 100.00
999 | 200.00
888 | 300.00
What I am trying to do is find all records that belong to Table1.RefNum. Then using those Table1.PartNum to find the NewPartNum in Table2 and the Price from Table3
The problem I'm having is that if there is not match from Table1.PartNum = Table2.PartNum, then it returns no data. For example, if I restrict the query to Table1.RefNum=" 4-1", what I would like to get returned is:
Table1.RefNum | Table1.PartNum | Table2.NewPartN um | Table3.Price
4-1 | ABC | 123 | 100.00
4-1 | DEF | Null | Null
Unfortunately I can't figure out the correct way to join these 3 tables so that I see ALL the results from Table1 and only the matching results from Table2 & Table3 (with "nulls" listed for those that don't have a match)
Here's the situation
Table1
Fields: RefNum & PartNum
In this table there may be multiple PartNum associated with a RefNum
Ex:
RefNum | PartNum
4-1 | ABC
4-1 | DEF
4-2 | AAA
4-3 | BBB
Table2
Fields PartNum, NewPartNum
The PartNum will match up to Table1.PartNum although there may not be a match at all
Ex:
PartNum | NewPartNum
ABC | 123
AAA | 999
BBB | 888
Table3
Fields PartNum, Price
This PartNum will also match up to Table2.NewPartN um
Ex:
PartNum | Price
123 | 100.00
999 | 200.00
888 | 300.00
What I am trying to do is find all records that belong to Table1.RefNum. Then using those Table1.PartNum to find the NewPartNum in Table2 and the Price from Table3
The problem I'm having is that if there is not match from Table1.PartNum = Table2.PartNum, then it returns no data. For example, if I restrict the query to Table1.RefNum=" 4-1", what I would like to get returned is:
Table1.RefNum | Table1.PartNum | Table2.NewPartN um | Table3.Price
4-1 | ABC | 123 | 100.00
4-1 | DEF | Null | Null
Unfortunately I can't figure out the correct way to join these 3 tables so that I see ALL the results from Table1 and only the matching results from Table2 & Table3 (with "nulls" listed for those that don't have a match)
Comment