SELECT sum(VAL) as val FROM ( SELECT QU, SUM ( VAL ) AS VAL FROM ( SELECT DISTINCT CASE
WHEN PROJADDRESS IN ( '北京', '天津', '河北', '山西', '内蒙', '辽宁', '吉林', '黑龙江' ) THEN '华北 ' WHEN PROJADDRESS IN ( '上海', '安徽', '江苏', '浙江', '江西', '山东' ) THEN '华东 ' WHEN PROJADDRESS IN ( '河南', '湖北', '湖南', '广东', '广西', '海南', '福建' ) THEN '中南 ' WHEN PROJADDRESS IN ( '重庆', '四川', '贵州', '云南', '西藏' ) THEN '西南 ' WHEN PROJADDRESS IN ( '甘肃', '陕西', '青海', '宁夏' ) THEN '西北 ' WHEN PROJADDRESS IN ( '新疆' ) THEN '新疆 ' ELSE ( '' ) END AS QU, SUM ( PMCSUM + TRADITIONSUM )/750000 AS VAL FROM DBO.ONCONTRACT where 1=1 ${IF( LEN( DDD ) = 0, "", IF ( DDD = "总包", "AND CODE LIKE '%总包%'", "AND CODE NOT LIKE '%总包%'" ) ) } ${IF( LEN( EEE ) = 0, "", "AND CONTRACTKIND IN ('" + EEE + "')" ) } GROUP BY PROJADDRESS ) AS A WHERE QU NOT IN ( '' ) ${IF( LEN( FFF ) = 0, "", "AND QU IN ('" + FFF + "')" ) } GROUP BY QU ) AS FF WHERE 1 = 1 |