mysql - How to count comments while selection posts -
i have 2 tables
tb_posts id,title,description
tb_comments id,post_id,comment
i want select posts count of comments.
how write single query it?
i think should do:
select tb_posts.id, tb_posts.title, tb_posts.description tb_posts inner join tb_comments on tb_posts.id = tb_comments.post_id group tb_posts.id, tb_posts.title, tb_posts.description having count(*) > some_threshold_value
Comments
Post a Comment