For example, if I have a column representing the flag Y or N , what percentage is Y and what percentage is N ? I know that I can write a query to find each of these numbers and then calculate the percentage myself, but I believe that this should be straightforward, doing it in PL / SQL with analytic functions like NTILE .
SELECT COUNT(1), enabled_flag FROM widgets GROUP BY enabled_flag;
Gives me:
COUNT(1) | enabled_flag 123124 | Y 234234 | N
I need:
enabled_flag | percentage Y | 34 N | 56
Can someone point me in the right direction?
source share