- Impact
- 18
I currently have this mysql query:
Now I also want to count the amount of subcategories in a category (so that I can divide it by 3 for layout reasons! :D). in the table "subcategories" I have "cat_id" which is linked to the categories table, "subcat_id" which isn't really of any use in this script, and "subcat_name". in the "categories" table I have "cat_name" and I have "cat_id".
How would I go about doing it?
Thanks
Tom
Code:
SELECT c.*, s.* FROM categories c, subcategories s WHERE c.cat_id=s.cat_id GROUP BY c.cat_id ORDER BY c.cat_name ASC
Now I also want to count the amount of subcategories in a category (so that I can divide it by 3 for layout reasons! :D). in the table "subcategories" I have "cat_id" which is linked to the categories table, "subcat_id" which isn't really of any use in this script, and "subcat_name". in the "categories" table I have "cat_name" and I have "cat_id".
How would I go about doing it?
Thanks
Tom






