DECLARE @tot_quest AS float DECLARE @acc_quest AS float D...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Emacs

Q&A for those using, extending or developing Emacs

DECLARE @tot_quest AS float
DECLARE @acc_quest AS float
DECLARE @unansw_quest AS float
DECLARE @no_resp AS float

DECLARE @acc_quest_ratio AS float
DECLARE @unansw_quest_ratio AS float
DECLARE @no_resp_ratio AS float



SELECT @tot_quest = count(Id)
FROM Posts
WHERE Posts.PostTypeId = 1

/*Accepted ratio*/
SELECT @acc_quest = count(Posts.Id)
FROM Posts, PostTags, Tags
WHERE Tags.TagName = '.net' AND
      Posts.PostTypeId = 1 AND
      Tags.Id = PostTags.TagId AND
      PostTags.PostId = Posts.Id AND
      AcceptedAnswerId IS NOT NULL


/*Unanswered ratio*/
/*SELECT @unansw_quest = count(quest.Id) 
FROM Posts answ, Posts quest, Votes, VoteTypes
WHERE quest.Id = answ.ParentId AND
      answ.Id = Votes.PostId AND
      VoteTypes.id = 2 AND
      Votes.VoteTypeId = VoteTypes.id 
GROUP BY quest.Id, answ.Id, VoteTypes.Id
HAVING count(Votes.VoteTypeId) < 2*/
SELECT @unansw_quest = count(Posts.Id)
FROM Posts, PostTags, Tags
WHERE Tags.TagName = '.net' AND
      Posts.PostTypeId = 1 AND
      Tags.Id = PostTags.TagId AND
      PostTags.PostId = Posts.Id AND
      AcceptedAnswerId IS NULL


/*No-Response ratio*/
SELECT @no_resp = count(Posts.Id)
FROM Posts, PostTags, Tags
WHERE Tags.TagName = '.net' AND
      Posts.PostTypeId = 1 AND
      Tags.Id = PostTags.TagId AND
      PostTags.PostId = Posts.Id AND
      Posts.AnswerCount = 0


SET @acc_quest_ratio = (100/@tot_quest) * @acc_quest
SET @unansw_quest_ratio = (100/@tot_quest) * @unansw_quest
SET @no_resp_ratio = (100/@tot_quest) * @no_resp

PRINT 'Tag .net'
PRINT 'Totale domande                 ->' + str(@tot_quest)
PRINT 'Domande con risposta accettata ->' + str(@acc_quest)
PRINT ''
PRINT 'Accepted Ratio                 ->' + str(@acc_quest_ratio, 13, 2)
PRINT 'Unanswered Ratio               ->' + str(@unansw_quest_ratio, 13, 2)
PRINT 'No-Response Ratio              ->' + str(@no_resp_ratio, 13, 2)

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results