'IS there a possibility to get the "same" attribute into one column from different tables?
So I have two the two tables with a primary key month_cd:
Table A:
| month_cd | stuff | stuff2 |
|---|---|---|
| First | 1 | null |
| Second | 2 | null |
| Third | null | 2 |
Table B:
| month_cd | stuff | stuff2 |
|---|---|---|
| First | null | 2 |
| Third | 3 | null |
| Fourth | 4 | 3 |
I need them to look like this in the third table C.
Table C:
| month_cd | stuff | stuff2 |
|---|---|---|
| First | 1 | 2 |
| Second | 2 | null |
| Third | 3 | 2 |
| Fourth | 4 | 3 |
I tried doing full outer join with coalesce(A.month_cd, B.month_cd, C.month_cd), but somewhy it gives me doubles like
Table C:
| month_cd | stuff | stuff2 |
|---|---|---|
| First | 1 | null |
| First | null | 2 |
| Second | 2 | null |
| Third | 3 | null |
| Third | null | 2 |
| Fourth | 4 | 3 |
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
