'Merge or join two tables SQL Server
I have a table with two columns Item, Qty and another table with Product, Quantity.
Table A
| Item | Qty |
|---|---|
| a | 10 |
| a | 15 |
| a | 5 |
| b | 10 |
Table b
| Product | Quantity |
|---|---|
| a | 10 |
| a | 20 |
| b | 5 |
| b | 5 |
The output that I'm looking for is this:
| item | Qty | Product | Quantity |
|---|---|---|---|
| a | 10 | a | 10 |
| a | 15 | a | 20 |
| a | 5 | NULL | NULL |
| b | 10 | b | 5 |
| NULL | NULL | b | 5 |
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
