User Counts of ratio of answer to question


Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

SELECT top 10
          WHEN pvt.Answer <> 0 THEN
          cast(pvt.Question as decimal(10,5))
           cast(pvt.answer  as decimal(10,5)) 
          END ratio
FROM   (SELECT p.owneruserid, 
        FROM   posts p 
               INNER JOIN posttypes pt 
                 ON p.posttypeid =
                 WHERE pt.ID in (1,2) and p.ownerUserID is not null) p 
       PIVOT (
       COUNT ( 
       FOR IN ([Question], [Answer])) AS pvt

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results