In questo esempio abbiamo 3 tabelle correlate in un database SQLite:sqlite LEFT OUTER JOIN più tabelle
CREATE TABLE test1 (
c1 integer,
primary key (c1)
);
CREATE TABLE test2 (
c1 integer,
c2 integer,
primary key (c1, c2)
);
CREATE TABLE test3 (
c2 integer,
c3 integer,
primary key (c2)
);
Ora ho bisogno di unire tutte le tabelle:
test1 -> test2 (with c1 column) test2 -> test3 (with c2 column).
ho provato questa soluzione, ma non viene eseguito:
SELECT
*
FROM test1 a
LEFT OUTER JOIN test2 b
LEFT OUTER JOIN test3 c
ON c.c2 = b.c2
ON b.c1=a.c1
mi dà un errore: near "ON": syntax error.
Qualsiasi aiuto?
sqlite3 mai usato, ma la sintassi SQL standard corretto è LEFT OUTER JOIN ... ON ... LEFT OUTER JOIN ... ON. .., e non annidati.) – raina77ow
Ho usato questa sintassi su Oracle, PostgreSQL e SQLServer senza alcun problema. – ferpega
Join nidificati - o 'JOIN (one JOIN two JOIN three) ON (one.id = two.id AND two.some_id = three.some_id)'? – raina77ow