Hey guys
I am new to SQL and looking for some help please. I need to combine data from 4 different tables (the common field between the first 3 is the same while table 4 is common only with table 3.
Here is my table columns:
Table 1 - 'Items' Columns:
Item_Code, Item_Min, Item _max
Table 2 - 'Stock on Hand' Columns:
Item_Code, Quantity
Table 3 - 'Purchase Orders Lines'
Item_Code, Quantity, Order_Num, Status
Table 4 - 'Purchase Order Headers'
Order_Num, Date Raised, Fulfilled
What I want:
Item_Code (1) , Quantity (Table 2), Quantity (Table 3), Date Raised (Table 4)
First I need to do an inner join between Table 3 and 4 on Order_Num where Status (Table3 ) = 'Ordered' and where Fulfilled (Table 4) = 'U'
After that, I need to do an outer left join between Table 1, Table 2 and the new table from above on item_code where Table 1 is the master.
Any advise?
I am truly puzzled. Maybe I am going about it wrong?
I am new to SQL and looking for some help please. I need to combine data from 4 different tables (the common field between the first 3 is the same while table 4 is common only with table 3.
Here is my table columns:
Table 1 - 'Items' Columns:
Item_Code, Item_Min, Item _max
Table 2 - 'Stock on Hand' Columns:
Item_Code, Quantity
Table 3 - 'Purchase Orders Lines'
Item_Code, Quantity, Order_Num, Status
Table 4 - 'Purchase Order Headers'
Order_Num, Date Raised, Fulfilled
What I want:
Item_Code (1) , Quantity (Table 2), Quantity (Table 3), Date Raised (Table 4)
First I need to do an inner join between Table 3 and 4 on Order_Num where Status (Table3 ) = 'Ordered' and where Fulfilled (Table 4) = 'U'
After that, I need to do an outer left join between Table 1, Table 2 and the new table from above on item_code where Table 1 is the master.
Any advise?
I am truly puzzled. Maybe I am going about it wrong?
Last edited: