Counting all the posts belonging to a category AND its subcategories

后端 未结 2 1553
旧巷少年郎
旧巷少年郎 2021-01-07 04:38

I would really appreciate some help with my problem:

I have 2 MySQL tables, categories and posts, laid out (simplified) like so:

categories:

2条回答
  •  猫巷女王i
    2021-01-07 05:09

    I think you want to look at the Rollup operator. I believe this will get you what you want.

    http://msdn.microsoft.com/en-us/library/ms189305(SQL.90).aspx

    Randy

提交回复
热议问题