【发布时间】:2017-04-01 01:22:16
【问题描述】:
假设我有 3 张桌子,我想像这样加入它们:
table 1 join table 2 and table 2 join table 3
我正在尝试以下代码,但出现语法错误。
SELECT * from table1 join table2 and table2 join table3
on table1.id=table2.idA and table2.idB=table3.id
【问题讨论】:
假设我有 3 张桌子,我想像这样加入它们:
table 1 join table 2 and table 2 join table 3
我正在尝试以下代码,但出现语法错误。
SELECT * from table1 join table2 and table2 join table3
on table1.id=table2.idA and table2.idB=table3.id
【问题讨论】:
学习一下 SQL。语法如下:
select *
from table1 join
table2
on table1.id = table2.idA join
table3
on table2.idB = table3.id;
这是非常基本的JOIN 语法,应该包含在任何教程、文档、书籍、论文或任何你用来学习 SQL 的东西中。
【讨论】: