Advertisement
kieni17

Untitled

Mar 23rd, 2020
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.45 KB | None | 0 0
  1. SELECT DISTINCT p.* FROM users u, posthistory h, posts p, badges b
  2. WHERE u.id = h.userid AND h.userid = u.id
  3.       AND h.userdisplayname = u.displayname AND p.id = h.postid
  4.       AND b.userid = u.id
  5.       AND b.name IN ( 'Autobiographer', 'Teacher')
  6.       AND ( SELECT AVG(u2.upvotes) FROM users u2
  7.             WHERE u2.creationdate > p.creationdate)
  8.           >=
  9.           ( SELECT COUNT(*) FROM votes v WHERE v.votetypeid = 3 AND v.postid = h.postid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement