Q&A for designers and implementers of computer programming languages
DECLARE @UserId int = ##UserId##; DECLARE @MinDate datetime = ##MinDate:string##; DECLARE @MaxDate datetime = ##MaxDate:string##; SELECT COUNT(DISTINCT Answers.Id) AS Answers, SUM(Answers.Score) AS AnswerVotes, SUM(Questions.Score) AS QuestionVotes, SUM(Questions.ViewCount) AS Views FROM Posts AS Answers INNER JOIN Posts AS Questions ON (Answers.ParentId = Questions.Id) WHERE Answers.OwnerUserId = @UserId AND Answers.CreationDate >= @MinDate AND Answers.CreationDate <= @MaxDate AND Answers.PostTypeId = 2;