SELECT q.Id ,q.Title ,q.Body ,q.Tags ,q.Score ,q.ViewCoun...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT 
q.Id
,q.Title
,q.Body
,q.Tags
,q.Score
,q.ViewCount
,a.Score as AnswerScore
,a.Body as Answer

FROM Posts as q
LEFT JOIN Posts as a ON q.AcceptedAnswerId = a.Id
INNER JOIN PostTypes as pt ON q.PostTypeId = pt.Id

WHERE DATEPART(YEAR, q.CreationDate) IN (2019, 2020)
AND pt.Name LIKE 'Question'

ORDER BY q.Score;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results