SELECT b.EC_CITY_NAME, b.EC_ITEM_TIME, SUM(b.TOTAL_USAGE), SUM(b.AIRCON_USAGE),SUM(b.MAIN_USAGE), SUM(GENERATOR_USAGE)
FROM
(SELECT
sr.NAME as EC_CITY_NAME,
to_char(rcs.READTIME,'yyyymm') as EC_ITEM_TIME,
to_char(add_months(trunc(READTIME),-12), 'yyyymm') as EC_ITEM_TIME_LASTYEAR,
to_char(add_months(trunc(READTIME),-1), 'yyyymm') as EC_ITEM_TIME_LASTMONTH,
rb.BTSNAME as EC_ARENA_NAME, rcs.TOTAL_USAGE as TOTAL_USAGE,
round(rcs.AIRCON_USAGE,2) as AIRCON_USAGE,
rcs.MAIN_USAGE as MAIN_USAGE,
rcs.GENERATOR_USAGE as GENERATOR_USAGE
FROM SYS_REGION sr
full join RES_BTS rb
ON sr.CODE = rb.CITYID
join RPT_CAP_BTS rcs
ON rcs.BTSID = rb.ZGID) b
GROUP BY b.EC_ITEM_TIME, b.EC_CITY_NAME
FROM
(SELECT
sr.NAME as EC_CITY_NAME,
to_char(rcs.READTIME,'yyyymm') as EC_ITEM_TIME,
to_char(add_months(trunc(READTIME),-12), 'yyyymm') as EC_ITEM_TIME_LASTYEAR,
to_char(add_months(trunc(READTIME),-1), 'yyyymm') as EC_ITEM_TIME_LASTMONTH,
rb.BTSNAME as EC_ARENA_NAME, rcs.TOTAL_USAGE as TOTAL_USAGE,
round(rcs.AIRCON_USAGE,2) as AIRCON_USAGE,
rcs.MAIN_USAGE as MAIN_USAGE,
rcs.GENERATOR_USAGE as GENERATOR_USAGE
FROM SYS_REGION sr
full join RES_BTS rb
ON sr.CODE = rb.CITYID
join RPT_CAP_BTS rcs
ON rcs.BTSID = rb.ZGID) b
GROUP BY b.EC_ITEM_TIME, b.EC_CITY_NAME