Self referential table and recursive SQL function

dqsohy4hey

New Member
I have a category table with:
  • categoryID
  • parentCategoryID
  • categoryName
and an items table with:
  • itemID
  • categoryID
  • itemName
I am using MySQL. i want to write a query that will return a count of Items in a category given a categoryID. The query should return total count for all items in all subcategories of the given category.I hope this makes sense.. sorry if i am not using the correct nomenclature.
 
Back
Top