Mysql 别名内部连接链问题

Mysql alias the chain of inner joins issue

我有以下查询

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 是作业中的列 table。

我希望圆括号中的 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