I have the feeling this has a really simple solution and I’m just suffering a brain freeze, but I hope you can help.
I have 2 tables that have identical layouts but data from separate systems and I want to combine them in a query for reporting purposes. But the column I would normally join on may have values that are only in one or the other table.
Table A
Date | Sales
-------------------
20/12/2010 | 500
19/12/2010 | 450
Table B
Date | Sales
-------------------
20/12/2010 | 200
18/12/2010 | 70
I want these in a result set as so:
Result
Date | Sales A | Sales B
-------------------------------
20/12/2010 | 500 | 200
19/12/2010 | 450 | NULL
18/12/2010 | NULL | 70
This look so simple and obvious but I can’t get it right, and help would be greatly appreciated.
Using Outer Joins in SQL Server: