Getting Percentage of coloumn value
| From: | JJ Harrison | Date: | Tue, 09 Jul 2002 11:38:10 +0000 |
| Subject: | Getting Percentage of coloumn value | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20423@lists.php.net to get a copy of this message | ||
Could some one give me an idea as to what I SQL query could use to get the
percentages of each differant colomn value.
ie if this was my table:
+-------+---+
| name | id |
+-------+---+
| foobar | 1 |
| foobar | 2 |
| foobar | 3 |
| barfoo | 4 |
+-------+---+
I would get this result(Then later do stuff with it in PHP):
+-------+--------+
| name | percent |
+-------+--------+
| foobar | 75 |
| barfoo | 25 |
+-------+--------+
Thanks in advance,
--
JJ Harrison
webmaster@tececo.com
www.tececo.com