grouping sets
I'm creating a Materialized View which uses UNION ALL. The unions are needed in order to populate data at a specific period of time AND earlier. To reduce the coding and improve performance, I want to use grouping sets instead. I haven't been able to get grouping sets to work so that I have only one query. This is the test code query with UNION ALL:
SELECT
a.month_end, b.clinic ,b.patient_id,sum(b.payment)
FROM month_end_list a, patient b
WHERE trunc(a.month_end) = '31-MAR-2008'
and b.accounting_month <= a.month_end
group by a.month_end,b.clinic,b.patient_id
0