Left Join table 错误缺少别名

Left Join table error missing aliases

我在 mysql 中编写了一个查询,以从 job_input table 中获取所有记录,并在 job_output table 中获取相应的输出记录。它给出以下错误:

Query: select ji.* from job_input as ji left join (select SUM(jo.O_Total) AS Total_Output, SUM(jo.O_XS) AS XS_Output, SUM(jo.O_S) AS ...

Error Code: 1248 Every derived table must have its own alias

以下是我的查询。我做错了什么??

SELECT ji.* 
    FROM `job_input` AS ji LEFT JOIN
    (SELECT 
    SUM(jo.O_Total) AS Total_Output,
    SUM(jo.O_XS) AS XS_Output,
    SUM(jo.O_S) AS S_Output,
    SUM(jo.O_M) AS M_Output,
    SUM(jo.O_L) AS L_Output,
    SUM(jo.O_XL) AS XL_Output,
    SUM(jo.O_XXL) AS XS_Output,
    SUM(jo.O_Other) AS Other_Output FROM `job_output` AS jo GROUP BY jo.`Job_InputID`)
    ON jo.`Job_InputID`= ji.`Job_InputID`

您需要输入别名才能加入 table?

SELECT ji.* 
    FROM `job_input` AS ji LEFT JOIN
    (SELECT 
    jo.`Job_InputID` AS JobID
    SUM(jo.O_Total) AS Total_Output,
    SUM(jo.O_XS) AS XS_Output,
    SUM(jo.O_S) AS S_Output,
    SUM(jo.O_M) AS M_Output,
    SUM(jo.O_L) AS L_Output,
    SUM(jo.O_XL) AS XL_Output,
    SUM(jo.O_XXL) AS XS_Output,
    SUM(jo.O_Other) AS Other_Output FROM `job_output` AS jo GROUP BY jo.`Job_InputID`) AS table2
    ON table2.JobID = ji.`Job_InputID`