I have two tables with values pertaining to different items like this:
Table1:
ItemID | val1 | val2 | val3 |
ABC 5 1 2.5
DEF 5 5 3.8
GHI 2 1 4.9
MNO 8 2 1.1
PQR 1 8 2.4
Table 2:
ItemID | val4 | val5
ABC hi 4
DEF dude 9
GHI word3 0
JKL balls 1
MNO day 5
I would like to join the tables so that they are like this:
ItemID | val1 | val2 | val3 | val4 | val5
ABC 5 1 2.5 hi 4
DEF 5 5 3.8 dude 9
GHI 2 1 4.9 word3 0
JKL 0 0 0 balls 1
MNO 8 2 1.1 day 5
PQR 1 8 2.4 0 0
Where if one table doesn't have the item, it just defaults to zero and adds the column anyway. Is this possible in SQL Server?