SELECT p.* , ( SELECT COUNT(1) FROM votes v WHERE v.posti...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Exchange

Q&A for meta-discussion of the Stack Exchange family of Q&A websites

SELECT
    p.*
  , ( SELECT
          COUNT(1)
      FROM
          votes v
      WHERE
          v.postid = p.id
      AND v.votetypeid = 2
    ) AS upvotes
FROM
    posts p
WHERE
    p.posttypeid = 2
AND p.score >= 1000
ORDER BY
    p.score DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results