我有以下查询
select *
from
reservation r,
(
assignment a
INNER JOIN class_ c ON a.class_id = c.uniqueid
INNER JOIN scheduling_subpart ss ON c.subpart_id = ss.uniqueid
INNER JOIN instr_offering_config ioc ON ss.config_id = ioc.uniqueid
) as io
where
io.solution_id in (32931842) and
io = r.offering_id
注意:solution_id 是分配表上的列。
我希望括号中的 who 内部连接使用 io 别名,但出现语法错误:
Check the manual that corresponds to your MySQL server version for the right syntax to use near 'as io where io.solution_id in (32931842) and io = r.offering_id'
最佳答案
看起来您的意思是这样做:
select *
from
reservation r,
(
select * from assignment a /// You missed the select * from
INNER JOIN class_ c ON a.class_id = c.uniqueid
INNER JOIN scheduling_subpart ss ON c.subpart_id = ss.uniqueid
INNER JOIN instr_offering_config ioc ON ss.config_id = ioc.uniqueid
) as io
where
io.solution_id in (32931842) and
io = r.offering_id
关于Mysql别名内连接链问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47715397/