sqlite LEFT OUTER JOIN multiple tables

后端 未结 1 1681
醉话见心
醉话见心 2021-02-13 16:13

In this example we have 3 related tables on a SQLite database:

CREATE TABLE test1 (
    c1 integer,
    primary key (c1)
);
CREATE TABLE test2 (
    c1 integer,
         


        
1条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-13 16:50

    This is a simple misplacement of your ON statement. This conforms to SQL standard:

    SELECT * 
    FROM test1 a 
    LEFT OUTER JOIN test2 b ON b.c1=a.c1 
    LEFT OUTER JOIN test3 c ON c.c2=b.c2 
    

    This is explained in further depth here.

    0 讨论(0)
提交回复
热议问题