Q&A for participants in team and individual sport activities
with sss as (Select Q.CreationDate As QuestionDate, A.CreationDate as AnswerDate, YEAR(Q.CreationDate) as Y, DATEDIFF(second, Q.CreationDate, A.CreationDate) as TimeDiff From Posts A join Posts Q on A.id = Q.AcceptedAnswerid where Q.AcceptedAnswerId<> '' AND YEAR(Q.CreationDate)=2017) select max(TimeDiff) from sss