Q&A for Joomla! administrators, users, developers and designers
p.ViewCount, a.Id as AskerId, a.Reputation as AskerReputation, a.DisplayName as QuestionAsker, p.CreationDate as DateAsked, p.Id as PostId, p.Title, p.AnswerCount, p.Score as QuestionScore, t.TagName, b.Id as AnswererId, b.Reputation as AnswererReputation, b.DisplayName as Answerer, answer.CreationDate as DateAnswered, answer.Score as AnswerScore,
WHEN ((p.AcceptedAnswerId = answer.Id)) THEN 'selected answer'
ELSE 'attempted answer'
END as answertype,
FROM Users a, Posts p, Users b, Posts answer, PostTags pt, Tags t
WHERE p.OwnerUserId = a.Id -- or accountId?
AND t.TagName in ('r')
AND answer.OwnerUserId = b.Id -- or accountId
AND p.PostTypeId = 1 -- question
AND answer.PostTypeId = 2 -- answer
AND Pt.PostId = p.id
AND t.Id = pt.TagId
AND answer.parentid = p.Id
AND p.CreationDate >= '2017-01-01'
AND p.CreationDate < '2017-07-01'
ORDER by p.CreationDate asc, answertype desc;
-- For answered questions
-- give me
-- the question
-- the selected answer
-- the non-selected answers
-- the basic ids, scores of each, and their authors
-- for the language R
-- ordered by creation date