histogram of answer scores for a given user, date-limited


Please login or register to vote for this query.

(click on this box to dismiss)

Returns the distribution of scores on answers by a user during a given date interval. Not quite a histogram because the zeros don't get drawn.

Robotics Meta

Q&A about the site for professional robotic engineers, hobbyists, researchers and students

declare @EndDate datetime = (select case
  -- If we request 'today', actually use the date
  -- of the most recent transfer to this database,
  -- which may be as much as a week in the past.
  when lower(##EndDate:string?today##) = 'today' then max(CreationDate)
  -- Otherwise, specify the most recent date to include.
  else ##EndDate##
  from Posts
declare @StartDate datetime = dateadd(day, -1*##DaysBack?30##, @EndDate);

answers.Score as Score,
--COUNT(answers.Id) AS 'Answers with Score'
answers.Id [Post Link]
FROM Posts questions 
INNER JOIN Posts answers ON answers.ParentId = Questions.Id
WHERE answers.OwnerUserId = ##userId##
  AND questions.CommunityOwnedDate IS NULL
  AND answers.CreationDate between @StartDate and @EndDate

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results