SELECT t1.FYear,t1.type_name, t1.nTotal,t2.mTotal,t3.dTotal FROM (
SELECT
a.FYear,
tp.type,
tp.type_name,
SUM(a.FProPlan) as nTotal
FROM KL_ProductionPlan_Year a
INNER JOIN KL_Production_Type tp ON a.FNCParentCode=tp.FNCParentCode or a.FCompany = tp.FCompany AND a.FNCcode = tp.FNCcode
WHERE FYear=2022 and tp.type !=8 and tp.type !=5
GROUP BY tp.type order by tp.type)t1
LEFT JOIN
(SELECT
a.FYear,
tp.type,
tp.type_name,
SUM(a.FProPlan) as mTotal
FROM KL_ProductionPlan_Month a
INNER JOIN KL_Production_Type tp ON a.FCompany = tp.FCompany AND a.FNCcode = tp.FNCcode or a.FNCParentCode=tp.FNCParentCode
WHERE a.FYear =2022 AND a.FMonth=6 and tp.type !=8 and tp.type !=5
GROUP BY tp.type order by tp.type
) as t2 ON t1.FYear = t2.FYear AND t1.type = t2.type
LEFT JOIN
(
SELECT
a.FYear,
tp.type,
tp.type_name,
(SUM(a.FProPlan) /30) as dTotal
FROM KL_ProductionPlan_Month a
INNER JOIN KL_Production_Type tp ON a.FCompany = tp.FCompany AND a.FNCcode = tp.FNCcode or a.FNCParentCode=tp.FNCParentCode
WHERE a.FYear =2022 AND a.FMonth=6 and tp.type !=8 and tp.type !=5
GROUP BY tp.type order by tp.type
) as t3 ON t1.FYear = t3.FYear AND t1.type = t3.type
检查下关联条件 是不是条件不满足
报错信息贴一下