I am working on a few queries for management, and one they want to know relates to the number of shared content, i.e. someone shares a link and it’s clicked. Here’s what I created but it’s giving me a number that doesn’t pass the plausibility check - 80k. Am I missing something?
-- [params] -- string :interval = 1 month -- string :trunc = month with t as ( select date_trunc(:trunc, CURRENT_TIMESTAMP - INTERVAL :interval) as start, date_trunc(:trunc, CURRENT_TIMESTAMP) as end ) SELECT count(id) as "Total" FROM incoming_links i, t WHERE i.created_at between t.start and t.end