Counting pageviews per topic using the Data-Explorer plugin

Hi Alexandra,

Until a refactor takes places, I believe the following is the best we can do:

-- [params]
-- date :view_date = 2019-03-26
SELECT t.id AS topic_id, COUNT(t.id) AS first_time_views
FROM topics t 
JOIN topic_views tv ON t.id = tv.topic_id
GROUP BY t.id, viewed_at
HAVING viewed_at = :view_date
ORDER BY first_time_views DESC

You can specify a date using the field in the Data Explorer UI. The first column of the results will show linked topic titles with their reply count in parenthesis. The second column is the number of first time views of the topic on the day you specified.