Find all of a users answers with a score of 5 or more and computer the lag between the question asked date and the users answered date
Q&A for speakers of other languages learning English
-- Necromancer Badge For What? -- Find all of a users answers with a score of 5 or more and computer the lag between the question asked date and the users answered date DECLARE @UserId int = ##UserId## SELECT q.Title, q.CreationDate AS AskedDate, a.CreationDate AS AnsweredDate, DATEDIFF(day, q.CreationDate, a.CreationDate) AS DaysBetween, q.Id AS QuestionID, a.Id AS AnswerID FROM Posts AS q JOIN Posts AS a ON a.ParentId = q.Id WHERE a.OwnerUserId = @UserId AND a.PostTypeId = 2 AND a.Score >= 5 ;