Advertisement
kieni17

Untitled

Mar 31st, 2020
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.33 KB | None | 0 0
  1. SELECT p.id FROM posts p, comments c, users u, badges b
  2. WHERE c.postid = p.id
  3.   AND u.id = p.owneruserid AND u.id = b.userid
  4.   AND u.upvotes IN (SELECT MAX(upvotes) FROM users u WHERE u.creationdate > p.creationdate)
  5.   AND EXISTS (SELECT 1 FROM postlinks l WHERE l.relatedpostid > p.id)
  6.   AND (b.name LIKE 'Research Assistant');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement