in table LOG i have the following entries
userid item role
1 Apple Buyer
2 Banana Seller
3 Apple Buyer
1 Banana Seller
3 Orange Buyer
etc
i'm trying to create the following two tables with SQL. table 1:
item countUser1Buy countUser1Sell
Apple
Banana
Orange
AND TAble 2 (here i mean the mean of totals. as in, the mean of the total apples bought
item alluserBuyTotalMean allUserBuyTotalMedian allUserBuyRange allUserBuyStandardDev
Apple
Banana
Orange
i think the first should be a variation on
`SELECT `item`, `role`, count(`item`) as count FROM `LOG` GROUP BY `item`
which is close, giving me
item role count
Apple Buyer 1
Banana Seller 1
but i cant figure out how to make it as i'm trying to get. the second i'm really stumped. thanks