SELECT p.title, UpVote = SUM(CASE WHEN vt.name = 'UpMod' ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
   p.title,
   UpVote = SUM(CASE WHEN vt.name = 'UpMod' THEN 1 ELSE 0 END), 
   DownVote = SUM(CASE WHEN vt.name = 'DownMod' THEN 1 ELSE 0 END),
   Favorite = SUM(CASE WHEN vt.name = 'Favorite' THEN 1 ELSE 0 END),
   p.ViewCount,
   SUM(p.AnswerCount) AnswerCount,
   SUM(p.CommentCount) CommentCount
   FROM Posts p
      INNER JOIN Votes v ON p.Id = v.PostId
      INNER JOIN VoteTypes vt ON v.VoteTypeId = vt.Id
   WHERE vt.Name NOT IN ('DownMod', 'Offensive', 'Deletion', 'Spam')
      AND p.Tags LIKE '%oracle%'
   GROUP BY p.title, p.ViewCount
   ORDER BY ViewCount DESC;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results