Feedback

0

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 p.Id                                                           AS [Post Link],
       SUM(CASE f.VoteTypeId WHEN 2 THEN 1 WHEN 3 THEN -1 ELSE 0 END) AS [Feedback Score],
       SUM(CASE WHEN f.VoteTypeId = 2 THEN 1 ELSE 0 END)              AS Helpful,
       SUM(CASE WHEN f.VoteTypeId = 3 THEN 1 ELSE 0 END)              AS Unhelpful,
       p.Score                                                        AS [Actual Score]
FROM   Posts p
       JOIN PostFeedback f
         ON f.PostId = p.Id
WHERE  p.Id = ##PostId:int##
GROUP  BY p.Id, p.Score

Enter Parameters

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