Contributions and votes for: Add a column with a default value

1

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

SELECT
  Questions.Title
, Answers.Body
, Answers.Score AS AnswerScore
, COUNT(*) AS TotalAnswerVotes
, SUM(AnswerVotes.BountyAmount) AS TotalBountyAmount
, CASE WHEN (AnswerVotes.CreationDate >= '2018-07-03') THEN '6. Mike'
WHEN (AnswerVotes.CreationDate BETWEEN '2014-08-22' AND '2018-07-03') THEN '3. Yahoo'
WHEN (AnswerVotes.CreationDate BETWEEN '2010-07-31' AND '2014-08-22') THEN '2. John'
ELSE '1. James' END AS LastContributorWhileVoteWasCast
FROM Posts AS Questions
  LEFT OUTER JOIN Posts AS Answers ON Questions.Id = Answers.ParentId
  LEFT OUTER JOIN Votes AS AnswerVotes ON Answers.Id =AnswerVotes.PostId
WHERE 1=1
  AND Questions.Id = 92082
  AND Answers.Id = 92123
GROUP BY
  Questions.Title
, Answers.Body
, Answers.Score
, CASE WHEN (AnswerVotes.CreationDate >= '2018-07-03') THEN '6. Mike'
WHEN (AnswerVotes.CreationDate BETWEEN '2014-08-22' AND '2018-07-03') THEN '3. Yahoo'
WHEN (AnswerVotes.CreationDate BETWEEN '2010-07-31' AND '2014-08-22') THEN '2. John'
ELSE '1. James' END
ORDER BY LastContributorWhileVoteWasCast DESC

Enter Parameters

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