Hiya All,
Got a little query problem.
I am building a recipe website (www.cookseasonal.com). The front page should display a list of categories. Each catergory could have all other categories as subcategory. Data is stored as:
Category_to_recipe
[ca_nr][ca_re_nr]
Category
[ca_id][ca_name]
recipe
[re_id][..]
What I would like is to create a listing of all categories, with a count of the number of recipes in that category, and for each category a listing of all sub-cat listings (which is what I have now used for a temp front page listing).
Obviously I can
'select distinct ca_name, count(ca_nr)
from category
left join category_to_recipe on ca_id=ca_nr
group by ca_re_nr';
and then do the same query for each individual category to create the sub-listing. However that sounds to me like too many query.
Anybody here that can help me do this in one query?
Cheers,
J