Simplify SQL Query which aggregates per year
A CTE can be used in this case:

WITH yourdata as (
    SELECT TO_CHAR(date_created, 'YYYY') AS tc_date_created
    FROM ticket
    WHERE date_created &gt;= '2013-01-01' AND 
          date_created &lt;= '2017-06-01' 
)
SELECT tc_date_created, count(*)
FROM yourdata 
GROUP BY tc_date_created
ORDER BY tc_date_created;