Welcome Guest, Not a member yet? Register   Sign In
Listing list of posts with comment count for each post. SQL Query help?
#2

[eluser]umefarooq[/eluser]
a simple solution is sub query

Code:
select a.*,(select count(*) from blog_comments where blog_id = a.id ) as count from blog_posts as a

hope this will help you to get your desire result if there is no matching id than count will be 0


Messages In This Thread
Listing list of posts with comment count for each post. SQL Query help? - by El Forum - 05-04-2009, 05:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB