Requirement: a report showing the number of unresolved tickets that are over 14 days old.
It’s simple to use the built-in
%PAST_30_DAYS% placeholders to find tickets that were created over 7 days or 30 days ago, but there isn’t a placeholder for 14 days.
We need a way to compare the date/time of tickets were created with the date/time of 14 days ago.
SELECT DPQL_COUNT() AS 'Total unresolved over 14 days old' FROM tickets WHERE tickets.date_created > (NOW() - INTERVAL 14 DAY) AND tickets.status IN ('awaiting_user', 'awaiting_agent')
WHERE tickets.status IN ('awaiting_user', 'awaiting_agent') clause limits the tickets to those with Awaiting User or Awaiting Agent status, i.e. those which are unresolved.
You might think that we should include On Hold status in the list, but tickets on hold still have a
awaiting_agent - hold status is recorded with a separate