How to get percentage after grouping?
select person, t1.food, COUNT() total, COUNT() 100 / fcnt &quot;Perc %&quot;
from food_table t1, (select food, COUNT() fcnt from food_table group by food) testsum
where t1.food = testsum.food
group by t1.person, t1.food, fcnt
order by 1
Output
person  food    total   Perc % of total
1       bread   2       66
1      fruit    1       50
2      bread    1       33
2      fruit    1       50