SELECT q.Id AS QuestionId, q.Title AS QuestionTitle, q.Bo...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

-- Select the columns you want to export
SELECT 
    q.Id AS QuestionId, 
    q.Title AS QuestionTitle, 
    q.Body AS QuestionBody, 
    q.Tags AS QuestionTags, 
    q.CreationDate AS QuestionDate, 
    q.AcceptedAnswerId AS AcceptedAnswerId, 
    a.Id AS AnswerId, 
    a.Body AS AnswerBody, 
    a.CreationDate AS AnswerDate
-- Join the Posts table twice, once for questions and LEFT JOIN for answers
FROM Posts q
LEFT JOIN Posts a ON q.AcceptedAnswerId = a.Id
-- Filter by the tags you want, using % as a wildcard
WHERE q.Tags LIKE '%<programming>%' 
   OR q.Tags LIKE '%<classical-computing>%' 
   OR q.Tags LIKE '%<q#>%'
-- Filter by the date range you want, using yyyy-mm-dd format
AND q.CreationDate BETWEEN '2008-08-01' AND '2023-08-31'
-- Order by whether the question has an accepted answer first, then by the question date
ORDER BY 
    CASE 
        WHEN q.AcceptedAnswerId IS NOT NULL THEN 0 
        ELSE 1 
    END,
    q.CreationDate ASC;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results