SQL: Aggregate(s) for rows not being returned
I need some help with a SQL statement. The query is an aggregation of detail values, but I need to ensure that I'm getting aggregations for rows that are not being returned in the query. For example,
--ROADS
SELECT "principal_landuse",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'NORTH', "fee_amount", 0)), '$999G999G999D99')) AS "north_total",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'CENTRAL', "fee_amount", 0)), '$999G999G999D99')) AS "central_total",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'PALMER RANCH', "fee_amount", 0)), '$999G999G999D99')) AS "palmer_total",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'SOUTH', "fee_amount", 0)), '$999G999G999D99')) AS "south_total",
--ROADS
SELECT "principal_landuse",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'NORTH', "fee_amount", 0)), '$999G999G999D99')) AS "north_total",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'CENTRAL', "fee_amount", 0)), '$999G999G999D99')) AS "central_total",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'PALMER RANCH', "fee_amount", 0)), '$999G999G999D99')) AS "palmer_total",
LTRIM(TO_CHAR(SUM(DECODE("county_quadrant", 'SOUTH', "fee_amount", 0)), '$999G999G999D99')) AS "south_total",
0