1
SELECT
`blg`.`id` ,
`blg`.`heading` ,
`blg`.`description` ,
`cat`.`name` AS `categoryname` ,
`mem`.`firstname` AS `user` ,
(SELECT COUNT(*) FROM blog_comments WHERE blog_comments.status = '1' AND blog_comments.blogid = blg.id) AS `commentcount`
FROM `blogs` AS `blg`
INNER JOIN `blog_category` AS `cat` ON blg.category = cat.id
INNER JOIN `members_member` AS `mem` ON blg.user = mem.id
LEFT JOIN `blog_comments` AS `cmt` ON blg.id = cmt.blogid
WHERE ( blg.status = '1' )
GROUP BY blg.id ORDER BY `blg`.`id` ASC
非常感謝你 – Jothis