Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
Try:
SELECT `bid`, COUNT(`cid`) FROM `table` GROUP BY `bid` ORDER BY `bid`;I think that's all you need.
Okay… I'm going to assume a few things:
I apologize if I've renamed columns in a way you don't like, but most of my work is done in Rails and I prefer their naming conventions. Anyway, the query you asked for above is:
SELECT `blogs`.`id`, `blogs`.`name`, COUNT(`comments`.`id`)
FROM `blogs` INNER JOIN `comments` ON `blogs`.`id` = `comments`.`blog_id`
GROUP BY `blogs`.`id`
ORDER BY `blogs`.`id`;Hopefully that helps&8230;
Try changing the "INNER JOIN" to a "LEFT JOIN".
"LEFT JOIN" is the correct query for what you're looking for. I tested the query and it returned the expected result every time.
If I may ask… why are you developing your own CMS? I don't mean to sound condescending, but if you're not able to set up these queries, I think you're going to have a hard time successfully pulling off an entire CMS.
By the way… I'm available for hire if you're looking for a partner.
1 to 10 of 10