I have two tables:
currency_table_1
ID - currency_1
------------------
01 - EUR
02 - EUR
03 - EUR
04 - USD
05 - USD
06 - USD
currency_table_2
ID - currency_2
------------------
01 - EUR
02 - EUR
04 - JPY
05 - JPY
06 - JPY
07 - JPY
I want to FULL OUTER JOIN the two tables on the ID. In the result table I like to add a COUNT column which sums the ocurrences of unique currency combinations of the two tables. If there is no ID/currency in the other table, respectively, the currency value in that combination will show as [null]. For above example the result table would look like:
Count - currency_1 - currency_2
----------------------------------
3 - USD - JPY
2 - EUR - EUR
1 - EUR - [null]
1 - [null] - JPY
How does the sql look like? I am familiar with group by and joins, but didn't have success on that one so far. Thanks for your input!