I'm using sql to pull together a table like this:
person flavour purchase
andy likes-orange_hates-vanilla $5
george likes-orange_hates-icecream $5
gena likes-vanilla_hates-bourban $2
gena likes-vanilla_hates-bourban $4
Is it possible to go from that to:
total
likes-orange $10
likes-vanilla $6
even better would be
total av. purchase size av. purchases per person total people
likes-orange $10 $5 1 2
likes-vanilla $6 $3 2 1
I just have access to a phpmyadmin.
Try
select substring_index(flavor,'_',1), sum(purchase) from table group by 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With