Imagine the following:
MySQL Database containing a knowledge base, based on product.
When the user selects a product, all knowledge on this product is displayed.
The knowledge is grouped into 5 categories.
Now i run into the following: After the user selects the product, I need to query the database to get all knowledge on this particualr product, but i want to group it into the 5 categories.
The knowledge table has (at the moment) about 60 rows.... hopefully this will grow into 100's or even 1000's (it is good to know a lot :-)
Do I...
A) run 5 queries:
mysql_select("select from knowledge where product=$x and category=1");
-category 1-
-display results-
mysql_select("select from knowledge where product=$x and category=2");
-category 2-
-display results-
etc...
-OR-
😎 create a temporary table (select * from knowledge where product=$x), and then query the temp table for the 5 categories
What are the advantages and disadvantages of each query?
Is one of the methods more suitable for large tables?
Thanks for any advice :-)