Advertisement
Guest User

Count comments attached to a post

a guest
Aug 24th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.11 KB | None | 0 0
  1. SELECT `posts`.*, COUNT(`comments`.id) AS total FROM `posts` INNER JOIN `comments` WHERE `posts`.id = `comments`.nid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement