So this is base query of something. It displays total # of each columns and % of them in one row but I want it to display in 2 rows. 1st row displays only #s while 2nd row displays only percentage of each column in first row.
select column1,
column2,
column3,
total,
round((column1 / total) * 100, 2) as column1_percent,
round((column2 / total) * 100, 2) as column2_percent,
round((column3 / total) * 100, 2) as column3_percent,
round((total / total) * 100, 2) as total_percent,
from (select column1,
column2,
column3,
(column1 + column2 + column3) as total
from (select (select count(x) from table1 a, table2 b where ~~) as column1,
(select count(x) from table3 a, table4 b where ~~) as column2,
(select count(x) from table5 a, table6 b where ~~) as column3
from dual));
How do I make this work? Help.