SELECT pcategory.id, pcategory.name AS category_name,description, count(photos.category) AS num_of_items FROM photos, pcategory WHERE category = pcategory.id GROUP BY category_name ORDER BY pcategory.id ASC
basically as you can see it matches the category id/# the a certain field that has that category id. unfortunately i couldn't get a return of 0 count to a certain field... i need to show that this certain category has 0 items, because i'm using this in a photo gallery where it has categories for the photos....the query above only returns counts that are >0
hope you guys can help, thanks!!....btw, this is my first time to post here
, pcategory.name as category_name
, count(photos.category) as num_of_items
on pcategory.id = photos.category
by pcategory.id asc
great!!!! superb.....it works like a charm..heheh...thank you so much bro!!!!!...but is it ok if you could shortly explain the part you started using JOIN and how was it able to produce 0?? =) thanks alot again!!!