Q&A about the site for academics and those enrolled in higher education
create table #unanswered (Id int primary key, Total int) insert #unanswered 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 * from #unanswered