SELECT F,H,A AS 本月收入, A-E AS 环比,A-B AS 与19年比,A/C AS 完成预算, D AS 累计收入,D/G AS 完成年度预算 FROM(SELECT SUM(a.`本月收入` ) AS A,sum(C.19年收入) AS B ,SUM(D.本月指标) AS C,SUM(E.累计收入) AS D,SUM(上月收入) AS E,SUM(G.本年指标) AS G,B.DIVISION AS F,B.ISDIRECT AS H from (SELECT HOTELID,SUM(DAY) AS `本月收入`FROM dw_fd_ynjourrepWHERE CLS = 70000000 AND YEAR(DATE) = '${year(date)}' AND MONTH(DATE) = '${month(date)}' GROUP BY HOTELID)a, (SELECT A.HOTELID,A.DIVISION,B.ISDIRECT,B.SECTIONID FROM ods_fr_hotelextend AS A, ods_xms_hotelid AS B WHERE B.SECTIONID = 'HOTEL' AND A.HOTELID = B.HOTELID)B, (SELECT HOTELID, SUM(DAY) AS `19年收入`FROM dw_fd_ynjourrepWHERE CLS = 70000000 AND YEAR(DATE) = 2019 AND MONTH(DATE) = '${month(date)}' GROUP BY HOTELID)C,(SELECT HOTELID, BUDGET_MON AS 本月指标FROM ods_fr_hotincomebudgetWHERE YEAR(TS) = '${year(date)}' AND MONTH(TS) = '${month(date)}')D,( SELECT HOTELID, SUM(`DAY`) AS `累计收入`FROM dw_fd_ynjourrepWHERECLS = 70000000 AND YEAR(DATE) = '${year(date)}' GROUP BY HOTELID)E,(SELECT HOTELID, SUM(`DAY`) AS `上月收入`FROM dw_fd_ynjourrepWHERE CLS = 70000000 AND YEAR(DATE) = '${year(date)}' AND MONTH(DATE) = '${month(date)-1}' GROUP BY HOTELID)F,(SELECT HOTELID, BUDGET_MON AS 本年指标FROM ods_fr_hotincomebudgetWHERE YEAR(TS) = '${year(date)}' )GWHERE A.HOTELID = B.HOTELID AND C.HOTELID = B.HOTELID AND D.HOTELID = B.HOTELID AND E.HOTELID = B.HOTELID AND F.HOTELID = B.HOTELID AND G.HOTELID= B.HOTELID GROUP BY F,H)TGROUP BY F,H想都和B.hotelid联立 两两在一块是没问题的 但是好几个在一块数据就出现问题了 是什么情况