Per-day questions, votes, answers, views

0

Please login or register to vote for this query.

(click on this box to dismiss)

Tridion

Q&A for Tridion developers and administrators

DECLARE @DATE datetime = CAST(##DATE:string## AS datetime);
DECLARE @DATE2 datetime = DATEADD(DAY, 1, @DATE);

SELECT 
  ('http://math.stackexchange.com/q/'+CAST(p.Id AS varchar)+'|#'+CAST(p.Id AS varchar)) as 'Post ID', 
  SUM(p.ViewCount) as 'Views', 
  COUNT(v.Id) as 'Votes'
FROM
  Posts p LEFT JOIN
  (SELECT * FROM PostFeedBack pfb WHERE
      pfb.CreationDate > @DATE AND pfb.CreationDate < @DATE2
  ) v ON p.Id = v.PostId
WHERE 
  p.CreationDate > @DATE AND p.CreationDate < @DATE2
  AND p.PostTypeId = 1 AND v.VoteTypeId IN (2,3)
GROUP BY p.Id

Enter Parameters

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