Order Questions for given tag by views per day

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 top 1000
   ps.id,
   cast(cast(ps.viewCount as float) / datediff(day, ps.creationDate, getdate()) as decimal(6,2)) viewsPerDay,
   ps.score,
   ps.favoriteCount,
   ps.title,
   ps.tags,
   ps.creationDate
from
   posts    ps                         join
   postTags pt on ps.id = pt.postId    join
   tags     tg on tg.id = pt.tagId 
where
   tg.tagName = ##tagName:string##
order by
   viewsPerDay desc

Enter Parameters

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