Working on querying total view of a category

So we’re wanting to measure the number of views a specific category gets and so I have done a query for it:

SELECT date_part('month', created_at) as Mth, 
     sum(views) as FAQViews 
FROM topics 
WHERE category_id = '11' 
GROUP BY Mth

and its returning values grouped by the month, but the values are like 1/100th what the category listing shows… Not sure what I am missing here

Looks more or less right except that you are not including year and you are including deleted content. Maybe your category_id is wrong…

4 Likes

Yeah - had the wrong category and need to also ignore deleted

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.