Q&A for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry
SELECT ROW_NUMBER() OVER (ORDER BY p.Score DESC) AS 'ID', p.Title AS 'Question', p.Id AS 'QID', u.DisplayName AS 'Asker', p.Score AS 'Q Score', p.AnswerCount AS 'Answers', p.ViewCount AS 'Views', a.Id AS 'AID', au.DisplayName AS 'Answerer', --sum(a.Score) AS 'A Score', a.CreationDate AS 'Date', p.Tags AS 'Tags' FROM Posts p JOIN Users u ON p.OwnerUserId = u.Id INNER JOIN PostTags pt ON p.Id=pt.PostId INNER JOIN Tags t ON t.id = pt.TagId JOIN Posts a ON p.Id = a.ParentId JOIN Users au ON a.OwnerUserId = au.Id WHERE t.TagName=##tagName:string?vba## AND YEAR(p.CreationDate) >= 2008 AND YEAR(p.CreationDate) <= 2012 --And p.PostTypeId = 1 --And p.Score <=10 --And p.Score >=0 --And p.AcceptedAnswerId is null ORDER BY p.Score DESC, a.Score DESC, a.CreationDate DESC