I have to get various results from different tables, having different timestamps in each entry, under one unique row, containing all the information from table a, the last update from table b, the last update from table c etc... This is my SQLFiddle
NULL values must be included.
Right now i have this situation:
| name | revenue | lastupdate_b | level | lastupdate_c |
|--------|---------|----------------------------|--------|----------------------------|
| foo | 12 | 2020-12-13 00:00:00.000000 | 1 | 2021-11-13 00:00:00.000000 |
| foo | 12 | 2020-12-13 00:00:00.000000 | 2 | 2021-11-12 00:00:00.000000 |
| foo | 13 | 2020-12-12 00:00:00.000000 | 1 | 2021-11-13 00:00:00.000000 |
| foo | 13 | 2020-12-12 00:00:00.000000 | 2 | 2021-11-12 00:00:00.000000 |
| bar | (null) | (null) | (null) | (null) |
| apple | 15 | 2020-12-11 00:00:00.000000 | 3 | 2020-11-11 00:00:00.000000 |
| banana | (null) | (null) | 4 | 2020-11-14 00:00:00.000000 |
| banana | (null) | (null) | 5 | 2020-11-15 00:00:00.000000 |
My expected output would be
| name | revenue | lastupdate_b | level | lastupdate_c |
|--------|---------|----------------------------|--------|----------------------------|
| foo | 12 | 2020-12-13 00:00:00.000000 | 1 | 2021-11-13 00:00:00.000000 |
| bar | (null) | (null) | (null) | (null) |
| apple | 15 | 2020-12-11 00:00:00.000000 | 3 | 2020-11-11 00:00:00.000000 |
| banana | (null) | (null) | 5 | 2020-11-15 00:00:00.000000 |
I'm currently using SQL Server but if there's a Oracle 12 version of the query it'll be welcome!