Two FULL OUTER JOINS
(Aggrega i dati da due tabelle)
SELECT * FROM Table1 T1 FULL OUTER JOIN Table2 T2 ON T1.IdT2 = T2.IdT2 FULL OUTER JOIN Table3 T3 ON T1.IdT3 = T3.IdT3;
IdT1 | Name | IdT2 | IdT3 |
---|---|---|---|
1 | Mauro | 1 | (null) |
2 | Andrea | 3 | (null) |
3 | Marco | 2 | (null) |
4 | Franco | 1 | (null) |
5 | Giovanna | 7 | (null) |
6 | Francesca | 5 | 2 |
7 | Giulia | (null) | 1 |
8 | Mario | (null) | 3 |
IdT2 | Color |
---|---|
1 | Giallo |
2 | Verde |
3 | Rosso |
4 | Arancio |
5 | Grigio |
6 | Nero |
7 | Rosa |
8 | Blue |
9 | Azzurro |
IdT3 | Food |
---|---|
1 | Pizza |
2 | Carne |
3 | Pesce |
IdT1 | Name | IdT2 | IdT3 | IdT21 | Color | IdT31 | Food |
---|---|---|---|---|---|---|---|
1 | Mauro | 1 | (null) | 1 | Giallo | (null) | (null) |
2 | Andrea | 3 | (null) | 3 | Rosso | (null) | (null) |
3 | Marco | 2 | (null) | 2 | Verde | (null) | (null) |
4 | Franco | 1 | (null) | 1 | Giallo | (null) | (null) |
5 | Giovanna | 7 | (null) | 7 | Rosa | (null) | (null) |
6 | Francesca | 5 | 2 | 5 | Grigio | 2 | Carne |
7 | Giulia | (null) | 1 | (null) | (null) | 1 | Pizza |
8 | Mario | (null) | 3 | (null) | (null) | 3 | Pesce |
(null) | (null) | (null) | (null) | 4 | Arancio | (null) | (null) |
(null) | (null) | (null) | (null) | 6 | Nero | (null) | (null) |
(null) | (null) | (null) | (null) | 8 | Blue | (null) | (null) |
(null) | (null) | (null) | (null) | 9 | Azzurro | (null) | (null) |