Q&A for SharePoint enthusiasts
WITH QuestionAnswers AS ( SELECT q.Id AS QuestionId, q.Title AS QuestionTitle, q.Body AS QuestionBody, a.Id AS AnswerId, a.Body AS AnswerBody, q.Tags, ROW_NUMBER() OVER (ORDER BY q.CreationDate DESC) AS RowNumber FROM Posts q JOIN Posts a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 -- Questions AND a.PostTypeId = 2 -- Answers AND q.Tags LIKE '%<big-o>%' AND ( q.Tags LIKE '%<array>%' OR q.Tags LIKE '%<tree>%' OR q.Tags LIKE '%<binary-tree>%' OR q.Tags LIKE '%<binary-search-tree>%' OR q.Tags LIKE '%<heap>%' OR q.Tags LIKE '%<graph>%' OR q.Tags LIKE '%<linked-list>%' OR q.Tags LIKE '%<stack>%' OR q.Tags LIKE '%<queue>%' ) AND q.CreationDate BETWEEN '2023-01-01' AND '2023-06-30' ) SELECT QuestionBody, AnswerBody, Tags FROM QuestionAnswers WHERE RowNumber BETWEEN 1 AND 100