Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT p.id
- FROM posts p,
- comments c,
- users u,
- badges b,
- (SELECT u.creationdate , MAX(u.upvotes) AS maxUpVotes FROM users u GROUP BY u.creationdate) AS sub1,
- (SELECT MAX(relatedpostid) AS maxrelatedpostid FROM postlinks) AS sub2
- WHERE c.postid = p.id AND u.id = p.owneruserid AND u.id = b.userid
- AND b.name LIKE 'Research Assistant'
- AND u.upvotes = sub1.maxUpVotes
- AND sub2.maxrelatedpostid > p.id;
- AND sub1.creationdate > p.creationdate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement