Q&A about the site for members of the workforce navigating the professional setting
DECLARE @Keyword nvarchar(100) = '%##Keywords##%'
CREATE TABLE #unanswered (Id int primary key, Total int)
SELECT q.Id as Id,
CASE WHEN q.AcceptedAnswerId is null THEN -10
WHEN q.AcceptedAnswerId is not null THEN 0 END AS [Total]
FROM Posts q
SELECT TOP 400 p.Id as [Post Link],
case when p.AcceptedAnswerId is null then 'false' else 'true' end as [Answered],
((p.ViewCount * 0.01) + p.AnswerCount + u.Total) as Weight,
from Posts p
join #unanswered u on u.Id = p.Id
where p.Tags LIKE '%azure-active-directory%'
order by Answered, Weight desc