没有足够的值
INSERT INTO TAB_DWGZZCB SELECT * FROM
( SELECT ID,ID_MTH,BM,JFGJFS,SUM(RS) AS RS,SUM(HJ) AS HJ,SUM(XJ_GZFL) XJ_GZFL,SUM(JBGZ) JBGZ,
SUM(JTBT) JTBT,SUM(JJ) JJ,SUM(SHBZJF) SHBZJF,SUM(JXGZ) JXGZ,SUM(QTGZFLZC) QTGZFLZC,SUM(XJ_BZ) XJ_BZ,
SUM(LXF) LXF,SUM(TXF) TXF,SUM(TZYF) TZYF,SUM(SHBZ) SHBZ,SUM(YLF) YLF,SUM(JLJ) JLJ,SUM(ZFGJJ) ZFGJJ,SUM(TZBT) TZBT,
SUM(XZGGFBT) XZGGFBT,
SUM(QTBZZC) QTBZZC FROM ( SELECT * FROM( SELECT (CASE WHEN JFGJFS='行政全额' THEN 7 WHEN JFGJFS='行政附属' THEN 8 WHEN JFGJFS='全额事业' THEN 9 WHEN JFGJFS='差额事业' THEN 10 WHEN JFGJFS='自收自支' THEN 11 END) AS ID,
ID_MTH,BM,JFGJFS,COUNT(*) AS RS,0 AS HJ,0 AS XJ_GZFL,SUM(JBGZ_XJ)*12/10000 AS JBGZ, SUM(JTBT_XJ)*12/10000 JTBT,
SUM(NZYCXJJ)/10000 JJ,SUM(SHBZJF_XJ)*12/10000 SHBZJF,0 JXGZ,0 QTGZFLZC,0 XJ_BZ,0 LXF,0 TXF,0 TZYF,0 SHBZ,0 YLF,
SUM(DSZNFMJL)/10000 JLJ,SUM(ZFBT_ZFGJJ)*12/10000 ZFGJJ,SUM(ZFBT_TZBT)*12/10000 TZBT,
SUM(ZFBT_XZGGFBT)*12/10000 XZGGFBT,0 QTBZZC FROM TAB_XZ WHERE ID_MTH=201109
GROUP BY ID_MTH,BM,JFGJFS ORDER BY ID_MTH,BM,JFGJFS DESC)
UNION ALL SELECT * FROM( SELECT (CASE WHEN JFGJFS='行政全额' THEN 7 WHEN JFGJFS='行政附属' THEN 8 WHEN JFGJFS='全额事业' THEN 9 WHEN JFGJFS='差额事业' THEN 10 WHEN JFGJFS='自收自支' THEN 11 END) AS ID,
ID_MTH,BM,JFGJFS,SUM(RS) AS RS,SUM(HJ) AS HJ,SUM(XJ_GZFL) XJ_GZFL,SUM(JBGZ) JBGZ,SUM(JTBT) JTBT,SUM(JJ) JJ,SUM(SHBZJF) SHBZJF,
SUM(JXGZ) JXGZ,SUM(QTGZFLZC) QTGZFLZC,SUM(XJ_BZ) XJ_BZ,SUM(LXF) LXF,SUM(TXF) TXF,SUM(TZYF) TZYF,SUM(SHBZ) SHBZ,SUM(YLF) YLF,SUM(JLJ) JLJ,
SUM(ZFGJJ) ZFGJJ,SUM(TZBT) TZBT,SUM(XZGGFBT) XZGGFBT,
SUM(QTBZZC) QTBZZC FROM( SELECT * FROM (SELECT ID_MTH,BM,JFGJFS,COUNT(*) AS RS,0 AS HJ,0 AS XJ_GZFL,SUM(JBGZ_XJ)*12/10000 AS JBGZ,
(SUM(JCXJXGZ_XJ)+SUM(JTBT))*12/10000 AS JTBT,0 AS JJ,SUM(SHBZJF_XJ)*12/10000 AS SHBZJF,SUM(NDJLXJXGZ)/10000 AS JXGZ,
0 QTGZFLZC,0 XJ_BZ,0 LXF,0 TXF,0 TZYF,0 SHBZ,0 YLF,SUM(DSZNFMJL)/10000 AS JLJ,SUM(ZFBT_ZFGJJ)*12/10000 AS ZFGJJ,
SUM(ZFBT_TZBT)*12/10000 AS TZBT,SUM(ZFBT_XZGGFBT)*12/10000 AS XZGGFBT,
0 AS QTBZZC FROM TAB_SY_YWJY WHERE ID_MTH=201109 GROUP BY ID_MTH,BM,JFGJFS ORDER BY ID_MTH,BM,JFGJFS)
UNION ALL SELECT * FROM( SELECT ID_MTH,BM,JFGJFS,COUNT(*) AS RS,0 AS HJ,0 AS XJ_GZFL,SUM(JBGZ_XJ)*12/10000 AS JBGZ,
SUM(JT_XJ)*12/10000 AS JTBT,0 AS JJ,SUM(SHBZJF_XJ)*12/10000 AS SHBZJF,SUM(ANFFXM_HJ)/10000 AS JXGZ,0 QTGZFLZC,0 XJ_BZ,0 LXF,0 TXF,0 TZYF,
0 SHBZ,0 YLF,SUM(DSZNFMJL)/10000 AS JLJ,SUM(ZFBT_ZFGJJ)*12/10000 AS ZFGJJ,SUM(ZFBT_TZBT)*12/10000 AS TZBT,
SUM(ZFBT_XZGGFBT)*12/10000 AS XZGGFBT,0 AS QTBZZC FROM TAB_SY_QT WHERE ID_MTH=201109
GROUP BY ID_MTH,BM,JFGJFS ORDER BY ID_MTH,BM,JFGJFS) )GROUP BY ID_MTH,BM,JFGJFS ORDER BY ID_MTH,BM,JFGJFS ) )
GROUP BY ID_MTH,BM,ID UNION ALL SELECT * FROM ( SELECT (CASE WHEN JFGJFS='行政全额' THEN 13 WHEN JFGJFS='行政附属' THEN 14 WHEN JFGJFS='全额事业' THEN 15 WHEN JFGJFS='差额事业' THEN 16 WHEN JFGJFS='自收自支' THEN 17 END) AS ID,
ID_MTH,BM,JFGJFS,COUNT(*) AS RS,0 AS HJ,0 AS XJ_GZFL,0 AS JBGZ,0 AS JTBT,0 AS JJ,0 AS SHBZJF,0 AS JXGZ,0 QTGZFLZC,0 XJ_BZ,
SUM(YFGZHJ)*12/10000 LXF,0 TXF,0 TZYF,0 SHBZ,0 YLF,0 AS JLJ,0 AS ZFGJJ,0 AS TZBT,0 AS XZGGFBT,
SUM(XJ)/10000 AS QTBZZC FROM TAB_LTXRY WHERE ID_MTH=201109 AND LEIBIE='离休' GROUP BY ID_MTH,BM,JFGJFS
ORDER BY ID_MTH,BM,JFGJFS)
UNION ALL SELECT * FROM( SELECT (CASE WHEN JFGJFS='行政全额' THEN 19 WHEN JFGJFS='行政附属' THEN 20 WHEN JFGJFS='全额事业' THEN 21 WHEN JFGJFS='差额事业' THEN 22 WHEN JFGJFS='自收自支' THEN 23 END) AS ID,
ID_MTH,BM,JFGJFS,COUNT(*) AS RS,0 AS HJ,0 AS XJ_GZFL,0 AS JBGZ,0 AS JTBT,0 AS JJ,0 AS SHBZJF,0 AS JXGZ,0 QTGZFLZC,0 XJ_BZ,0 LXF,
SUM(YFGZHJ)*12/10000 TXF,0 TZYF,0 SHBZ,0 YLF,0 AS JLJ,0 AS ZFGJJ,0 AS TZBT,0 AS XZGGFBT,0 AS QTBZZC FROM TAB_LTXRY WHERE ID_MTH=201109 AND LEIBIE='退休' GROUP BY ID_MTH,BM,JFGJFS ORDER BY ID_MTH,BM,JFGJFS)
UNION ALL SELECT * FROM ( SELECT * FROM( SELECT 25 AS ID,ID_MTH,BM,'编外人员' AS JFGJFS,COUNT(*) AS RS,0