Recent unanswered questions (2 days), my top 1 tag(s), 80+ asker REP

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- forked from http://data.stackexchange.com/stackoverflow/query/4038/find-interesting-unanswered-questions

-- Find recent unanswered questions
-- Looks at unanswered questions in your top 5 tags and sorts them by
-- note: currently this is set to just your top tag, change below if needed

-- and asker's reputation has to be 80 or above
-- 80 is arbitrary, but it's something

-- and creation date of question is last 48 hours
--

-- top 500

DECLARE @UserId int = ##UserId##

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

-- change to TOP 5 for instance for top 5 tags
insert #tags 
SELECT TOP 1
    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,
minuteAge int
)

insert #unanswered (Id,minuteAge) 
select q.Id,datediff(minute,q.creationdate,getdate())   
from Posts q
where (select count(*) from Posts a where a.ParentId = q.Id and a.Score > 0) = 0
and CommunityOwnedDate is null and ClosedDate is null and q.ParentId is null 
and AcceptedAnswerId is null
-- and datediff(minute,creationdate,getdate())<(48*60) -- last 2 days
-- and datediff(minute,creationdate,getdate())<(480*60) -- last 20 days

select top 500 u.Id as [Post Link],minuteAge,round(cast(minuteAge as float)/60/24,1) as dayAge
from #unanswered u
join Posts p on u.Id = p.Id
join PostTags pt on pt.PostId = u.Id
join #tags t on t.TagId = pt.TagId  
join Users us on us.Id = p.OwnerUserId  
where us.Reputation>=80
order by minuteAge

Enter Parameters

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