sniperscope Posted December 17, 2009 Share Posted December 17, 2009 Hello, I have category in my site which has 17 different category. So how can i show how many products there is in that category? such as: category_1(12) category_2(0) category_3( ... etc. I can do that 17 sql query but i want to do it with single query. Thanks for help. Quote Link to comment https://forums.phpfreaks.com/topic/185473-category-listing/ Share on other sites More sharing options...
rajivgonsalves Posted December 17, 2009 Share Posted December 17, 2009 you should use count with group select count(*), category from table group by category; Quote Link to comment https://forums.phpfreaks.com/topic/185473-category-listing/#findComment-979203 Share on other sites More sharing options...
sniperscope Posted December 17, 2009 Author Share Posted December 17, 2009 :D Thanks for reply. Great appreciate. I felt my self stupid. How come i forgot to use GROUP.. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/185473-category-listing/#findComment-979210 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.