I have a table like this:
person_id food data
1 bread xxx
1 bread xxx
1 fruite xxx
2 bread xxx
2 fruite xxx
food can have only three values (bread, fruits), I want to get the percentage of bread each person has eaten, and there percentage of fruits each person has eaten.
I tried to do:
select count(*) from table
group by person_id, food
and that gives me:
player_id, food, number
but how can I continue from now?
I am on hadoop
Asked by Marco Dinatsoli
(151 rep)
Apr 13, 2021, 01:03 PM
Last activity: Apr 13, 2021, 03:08 PM
Last activity: Apr 13, 2021, 03:08 PM