Maybe try this:
-- [params]
-- int :topic_id =
-- date :start_date =
-- date :end_date =
SELECT COUNT(*) AS views
FROM topic_views
WHERE topic_id = :topic_id
AND viewed_at BETWEEN :start_date AND :end_date
you will need to specify the topic id (from the topic URL) and the date range parameters in YYYY-MM-DD format.