Hi I have a Join Statement Query
Table 1 = Items Table 2 = Purchase Orders
Some items are not in the purchase order table so leaving a column blank when fetch a data from purchase orders to join in the Items Table.
Objective is to make the null column 0 when the item id is not in the purchase order table
Table 1
|Item ID | Name | Quantity |
---------------------------
| 1 | IT1 | 5 |
| 2 | IT2 | 10 |
| 3 | IT3 | 15 |
----------------------------
Table 2
| PO ID | PO Name | Ordered | Item ID |
----------------------------------------
| 1 | PO1 | 10 | 1 |
| 2 | PO2 | 20 | 2 |
| 3 | PO3 | 15 | |
----------------------------------------
JOIN TABLE
Since PO3 Item ID has no corresponding Id to the item when join table should make it 0
| ID | PO Name | PO Ordered | Item Quantity |
-----------------------------------------------
| 1 | PO1 | 10 | 5 |
| 2 | PO2 | 20 | 10 |
| 3 | PO3 | 15 | 0 |
-----------------------------------------------