Distribution of unscored answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

A distribution of all your zero scored answers. How many are accepted and how many are not.

Tridion

Q&A for Tridion developers and administrators

SELECT 
 Count(*) as AnswerCount,
 IsAccepted
FROM (
 select case when q.AcceptedAnswerId = a.Id then 1 else 0 end as IsAccepted
 from Posts a 
 left join
 Posts q
 ON q.Id = a.ParentId
WHERE 
 a.OwnerUserId = ##UserId## 
 and a.postTypeId = 2 
 and a.score = 0
) x
GROUP BY IsAccepted
    
/*-------------------------------------------------------*/ 
/* Original code with comments and trials
  @balpha helped me get a proper result table */
 
/* 
  SELECT 
/*  a.Id as [Post Link], 
  a.Score, 
  a.CommunityOwnedDate, 
  a.postTypeId,
  a.AcceptedAnswerId,
  q.AcceptedAnswerId as [AnswerID],*/
 Count(*) as AnswerCount,
 IsAccepted
  /*(case st 
   when q.AcceptedAnswerId <> NULL then "Accepted" 
   when  q.AcceptedAnswerId IS NULL then "UnAccpted" 
   end st)*/
 --on a.Id = q.AcceptedAnswerId
 --v.VoteTypeId
FROM (
 select case when q.AcceptedAnswerId = a.Id then 1 else 0 end as IsAccepted
 from Posts a 
 left join
 Posts q
 ON q.Id = a.ParentId
WHERE 
 a.OwnerUserId = ##UserId## 
 and a.postTypeId = 2 
 and a.score = 0
) x
GROUP BY IsAccepted
    --(case when q.AcceptedAnswerId > 0 then [Accepted] else [UnAccpted] end)
    
    */

Enter Parameters

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