I am doing an SQL statement that tries to get the percentage..but i dont know how to do it in MySQL
here is the sample of my code:
SELECT count( * ) , rating, percentage....
FROM `acne_prod_rating`
WHERE prod_id =5
GROUP BY rating
the output should be like this:
count(*) rating percentage
7 1 70%
2 2 20%
1 3 10%
rating legend : ( this means..user rates the product)
1 = highly recommended , got 7 votes
2 = average , got 2 votes
3 = bad , got 1 vote
I know I can do it on client code, but I'd like in sql easy and faster