code_junkie

Get info for multiple users in thread topic

Nov 14th, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. SELECT u.`name`, u.`signature`, u.`rank`, COUNT(*) as numPosts
  2. FROM `users` u INNER JOIN `posts` p ON (u.`id` = p.`userId`)
  3. WHERE u.`id` IN (
  4. SELECT `userId` FROM `posts` WHERE `threadId` = 5
  5. )
  6. GROUP BY u.`name`, u.`signature`, u.`rank`
Add Comment
Please, Sign In to add comment