What is the best method to rollup all of my subqueries? I am trying to take the first column in my subqueries and use them at the top level, and the second column of the subqueries would be separate columns at the top level.
Here is an example:
select city, cnt, cnt1
from
(select FUNC_ID_TO_STR(a.name_id) city, count(a.VI_TC) cnt
from table1 a, table2 b
where a.VI_3 (+) = b.VI_3
and a.VI_6 (+)= b.VI_6
and a.VI_8 (+) = b.VI_8
and a.VI_TC (+) = b.VI_TC
and a.TC_IND = 'Y'
and A_TMST < SYSDATE - 28
group by a.name_id)
,
(select FUNC_ID_TO_STR(a.name_id) city, count(a.VI_TC) cnt1
from table1 a, table2 b
where a.VI_3 (+) = b.VI_3
and a.VI_6 (+)= b.VI_6
and a.VI_8 (+) = b.VI_8
and a.VI_TC (+) = b.VI_TC
and a.TC_IND = 'Y'
and A_TMST < SYSDATE - 21
and A_TMST > sysdate - 27
group by a.name_id)
);