Postgresql Merge strings
Table A and Table B below could guide me on what SQL / PLPGSQL I should use to get the desired result. Many thanks.
TABLE A
+--------+-------+-------+
| USR_ID | COL1 | COL2 |
+--------+-------+-------+
| 1 | | 101 |
+--------+-------+-------+
| 2 | | 101 |
+--------+-------+-------+
TABLE B
+--------+-------+-------+
| USR_ID | COL1 | COL2 |
+--------+-------+-------+
| 1 | 103 | |
+--------+-------+-------+
| 3 | 102 | |
+--------+-------+-------+
REQUIRED RESULT
+--------+-------+-------+
| USR_ID | COL1 | COL2 |
+--------+-------+-------+
| 1 | 103 | 101 |
+--------+-------+-------+
| 2 | | 101 |
+--------+-------+-------+
| 3 | 102 | |
+--------+-------+-------+
+3
source to share