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;
Tabelle su DB
Recordset Table1
Tabella persone
Tabella persone
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 |
Recordset Table2
Colore preferito
Colore preferito
IdT2 | Color |
---|---|
1 | Giallo |
2 | Verde |
3 | Rosso |
4 | Arancio |
5 | Grigio |
6 | Nero |
7 | Rosa |
8 | Blue |
9 | Azzurro |
Recordset Table3
Piatto preferito
Piatto preferito
IdT3 | Food |
---|---|
1 | Pizza |
2 | Carne |
3 | Pesce |
Recordset risultante
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) |