Trying to combine two tables with different columns and rows
TABLE_1
| id_product | product_state_1 |
|---------------------|------------------|
| 106002 | 1 |
| 114000 | 0 |
| 106005 | 1 |
| 106004 | 1 |
TABLE_2
| id_product | product_state_2 |
|---------------------|------------------|
| 106002 | 0 |
| 114000 | 1 |
| 106005 | 1 |
| 109005 | 1 |
Required result_table
| id_product | product_state_1 | product_state_2 |
|---------------------|------------------|------------------|
| 106002 | 1 | 0 |
| 114000 | 0 | 1 |
| 106005 | 1 | 1 |
| 109005 | NULL | 1 |
| 106004 | 1 | NULL |
I tried the following code with the UNION
SELECT * FROM TABLE_1 UNION SELECT * FROM TABLE_2;
but the following code does not give the required result.