Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT post.id as postId, post.title AS userpost, user.username AS user, COUNT(comment.`fk_post`) as NumberOfComments, SUM(vote_post.`amount`) as NumberOfVotes, post.url, post.time
- FROM user
- JOIN post ON user.id = post.fk_user
- join comment on comment.`fk_post` = post.id
- join vote_post on vote_post.`fk_post` = post.id
- GROUP BY post.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement