| | |
How to get the percentage..??
![]() |
•
•
Join Date: May 2005
Posts: 5
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Image Comparison Application using ASP.net?..Result in Percentage Format?..!! (ASP.NET)
- word counter, frequency, percentage (Java)
- Keyword Search and return match percentage (ASP)
- Format Number as percentage. (PHP)
- percentage (C++)
- Novell (Novell)
Other Threads in the MySQL Forum
- Previous Thread: secure access to customer portal page?
- Next Thread: Problem writing to DB can someone take a look at my query string??
Views: 19273 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" .db 1 ajax alphabet amazon aws camparingtocolumns cascade cast code convert count count(col) data database delete design distinct ec2 eliminate enter error form generator html images innerjoins insert join keyword keywords matchingcolumns multiple multipletables mysql mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch noob number open operand oracle order parse pdf php print query recursive relationaldatabases relationship relationships remove reorderingcolumns resultset retrieve script search select simpledb sort sql statement string syntax table tree type-conversion update values welsh





