语法问题是什么?我试图做INNER JOIN
3个表,但我收到以下错误消息
其他信息:关键字' on'附近的语法不正确。
SELECT train.id,
train.class_id,
train.type_id,
train.m_year,
train_type.type,
train_type.avarage_speed,
train_class.class,
train_class.capacity
FROM train
INNER JOIN
ON train.class_id = train_class.id
AND train.type_id = train_type.id
答案 0 :(得分:0)
使用INNER JOIN时,您错过了第2和第3张桌子。
INNER JOIN <Table 2> on train.class_id = train_class.id
INNER JOIN <Table 3> on train.type_id = train_type.id
答案 1 :(得分:0)
join.中存在语法错误 join的语法如下:
SELECT column_name(s)
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;
因此,您的查询将如下所示:
" SELECT train.id, train.class_id, train.type_id, train.m_year, train_type.type," & _
" train_type.avarage_speed, train_class.class, train_class.capacity FROM train" & _
" INNER JOIN train_class on train.class_id = train_class.id " & _
" INNER JOIN train_type on train.type_id = train_type.id"
答案 2 :(得分:0)
您使用三个表进行JOIN但未提及正确加入
加入语法
(table1 INNER JOIN table2 ON table1.ID = table2.ID) INNER JOIN table3 ON table1.ID = table3.ID
,您的查询应该是这样的
SELECT train.id,
train.class_id,
train.type_id,
train.m_year,
train_type.type,
train_type.avarage_speed,
train_class.class,
train_class.capacity
FROM (train
INNER JOIN train_class
ON train.class_id = train_class.id)
INNER JOIN train_type ON train.type_id = train_type.id
答案 3 :(得分:0)
你有错过的语法,表名,你的代码必须是:
#header h1 { margin-top; 0}