I need to look through all topics that were created in a specific category within a specific date range. Any way to do that?
Do you have Data Explorer installed? If so, this query by @simon will return all topics for a specific month, sorted by category. Would that do the trick?
-- [params]
-- int :months_ago = 1
WITH query_period as (
SELECT
date_trunc('month', CURRENT_DATE) - INTERVAL ':months_ago months' as period_start,
date_trunc('month', CURRENT_DATE) - INTERVAL ':months_ago months' + INTERVAL '1 month' - INTERVAL '1 second' as period_end
)
SELECT
t.id as topic_id,
t.category_id
FROM topics t
RIGHT JOIN query_period qp
ON t.created_at >= qp.period_start
AND t.created_at <= qp.period_end
WHERE t.user_id > 0
AND t.category_id IS NOT NULL
ORDER BY t.category_id, t.created_at DESC
(Note that we haven’t tested this yet so let us know if you have feedback).
3 Likes
If you click “options” after clicking the search icon, you can search by date, category, and a bunch of other stuff.
4 Likes