I am trying to pull up an outer join between two tables, on a specifc column "Identifier", however, I would only like to carry out the outer joins on the rows where additional column "Date" matches between the tables. Example of what I am trying to achieve is, for the two tables below:
+------------+---------------+-------------------+-----------------+
| Date | Identifier | TableA-Attribute1 |TableA-Attribute2|
+------------+---------------+-------------------+-----------------+
| date1 | Id1 | a | x |
| date1 | Id2 | b | y |
| date1 | Id3 | c | z |
| date2 | Id1 | d | x |
| date2 | Id2 | e | y |
+------------+---------------+-------------------+-----------------+
+------------+---------------+-------------------+-----------------+
| Date | Identifier | TableB-Attribute1 |TableB-Attribute2|
+------------+---------------+-------------------+-----------------+
| date1 | Id1 | aa | xx |
| date1 | Id2 | bb | yy |
| date1 | Id3 | cc | zz |
| date1 | Id4 | dd | xx |
| date2 | Id1 | ee | yy |
+------------+---------------+-------------------+-----------------+
I need to end up with something that looks like this:
+------------+---------------+---------+-------+--------+-------+
| Date | Identifier | A-Attr1 |A-Attr2|B-Attr1 |B-Attr2|
+------------+---------------+---------+-------+--------+-------+
| date1 | Id1 | a | x |aa |xx |
| date1 | Id2 | b | y |bb |yy |
| date1 | Id3 | c | z |cc |zz |
| date1 | Id4 | - | - |dd |xx |
| date2 | Id1 | d | x |ee |yy |
| date2 | Id2 | e | y |- |- |
+------------+---------------+---------+-------+--------+-------+
I was trying to do something like this
go select * from table1 full outer join (select * from table2 where table1.date=table2.date)
however, that unfortunately does not seem to be working.