Find interesting unanswered questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

Looks at unanswered questions in your top 20 tags and sorts them by a combined weight which takes into account: score, askers reputation and how well you do on that particular tag

Economics

Q&A for those who study, teach, research and apply economics and econometrics

set statistics io, time on
-- Find interesting unanswered questions
-- Looks at unanswered questions in your top 20 tags and sorts them by
-- a combined weight which takes into account: score, askers reputation and how
-- well you do on that particular tag

DECLARE @UserId int = ##UserId##

create table #tags (TagId int, [Count] int)

insert #tags 
SELECT TOP 20 
    TagId,
    COUNT(*) AS UpVotes 
FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
    INNER JOIN Votes ON Votes.PostId = Posts.Id and VoteTypeId = 2
WHERE 
    Posts.OwnerUserId = @UserId
GROUP BY TagId
ORDER BY UpVotes DESC


create table #unanswered (Id int primary key, Score int, OwnerUserId int)

insert #unanswered 
select q.Id,q.Score*100+t.SumCount/10,q.OwnerUserId 
from Posts q
INNER JOIN 
(
SELECT pt.PostID,sum(t.[Count]) SumCount FROM 
PostTags pt 
INNER JOIN #tags t ON t.TagID = pt.TagID
GROUP BY pt.PostID
) t ON t.PostID=q.ID
left join Posts a on a.ParentId = q.Id and a.Score > 0 
where a.ParentId is Null 
and q.CommunityOwnedDate is null and q.ClosedDate is null 
and q.ParentId is null 
and q.AcceptedAnswerId is null
GROUP BY q.Id,q.Score,t.SumCount,q.OwnerUserId


declare @i int = (SELECT count(*) 
FROM (
SELECT pt.PostID,sum(t.[Count]) SumCount FROM 
PostTags pt 
INNER JOIN #tags t ON t.TagID = pt.TagID
GROUP BY pt.PostID
) a
)
print @i






select top 2000 u.Id as [Post Link], 
(us.Reputation / 200.0 + u.Score * 100) as Weight 
from #unanswered u
join Users us on us.Id = u.OwnerUserId  
group by u.Id, us.Reputation, u.Score 
order by Weight desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results