I am having trouble solving this. Please help.
I have a table named Product_Information. I want to count the number of products present in a category and subcategory.
This is the table
Product_Id - Product_Title - Product_Sub_Category - Product_Category
1 ----------------abc------------------XYX------------------X
2 ----------------def------------------XYX------------------Z
3 ----------------ghi------------------XYX------------------X
4 ----------------jkl------------------XYM------------------Z
and I want the result to be like
result
------
Product_Category-Product_Sub_Category-count(Product_Id)
X--------------------XYX-------------------------2
Z--------------------XYX-------------------------1
Z--------------------XYM-------------------------1
(Sorry for presenting information in a bad way)
I used the following Query:
Select
Product_Category,
Product_Sub_Category,
count(`Product_Id`)
from product_information
group by
Product_Category
but it's giving me wrong result.