Re: How do you update multiple rows at the same time?
| From: | Brian Burg | Date: | Fri, 24 Jan 2003 22:15:10 +0000 |
| Subject: | Re: How do you update multiple rows at the same time? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-133061@lists.php.net to get a copy of this message | ||
first.. you need to find the number of categories in
the table.. Use a simple MySQL function for that.
Example:
mysql> SELECT
table.categoryfield, COUNT(*) FROM
table GROUP BY table.categoryfield;
this will return each category, and how many rows use
this category. Example:
+---------------------+----------------+
| table.categoryfield | table.COUNT(*) |
+---------------------+----------------+
| Category1 | 14356 |
| Category2 | 34 |
| Category3 | 343 |
+---------------------+----------------+
or if you just want the plain number of categories,
use COUNT(*). Example:
SELECT COUNT(DISTINCT table.categoryfield) FROM
table;
which returns a single element, the number of unique
categories.
I hope this may help you!
Regards,
Brian Burg
Hudsonville Web Design Team
http://www.hudsonville.k12.mi.us
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com