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, posts p1 WHERE u.creationdate > p1.creationdate 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 c.creationdate = sub1.creationdate
- AND u.upvotes = sub1.maxUpVotes
- AND sub2.maxrelatedpostid > p.id
- AND u.id = b.userid
- AND (b.name LIKE 'Research Assistant');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement