SELECT TOP 50000 p.Id AS id, p.ParentId as parent_id, p.C...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans

Q&A for music historians, critics, and fans

SELECT TOP 50000
      p.Id AS id,
	  p.ParentId as parent_id,
      p.CreationDate AS creation_date, 
      p.LastActivityDate AS last_activity_date,
      ISNULL(v.UpVote, 0) AS up_votes, 
      ISNULL(v.DownVote, 0) AS down_votes,
      REPLACE(REPLACE(REPLACE(p.Body, ',', '@@@@'), CHAR(10), '#@#$'), CHAR(13), '') AS body
FROM
(SELECT Votes.PostID, 
        UpVote = SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), 
        DownVote = SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) 
        FROM Votes WHERE VoteTypeId in (2,3) GROUP BY PostId) v
RIGHT JOIN Posts p ON v.PostID = p.id
WHERE p.PostTypeId = 2 and p.Id < 18075413
ORDER BY p.Id DESC

Enter Parameters

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