The query below creates a count of tickets created by month and year:
SELECT DPQL_COUNT() AS 'Tickets Created'
FROM tickets
GROUP BY DPQL_ALIAS(DATE_FORMAT(tickets.date_created, '%Y-%M'), 'Date Created')
ORDER BY tickets.date_created
Note we're using DATE_FORMAT to format the date the ticket was created so the count is per month. *
We're also using DPQL_ALIAS to format the title of the group by column to 'Date Created':
* You can format the date using standard MYSQL specifiers. There's a useful list of options from the mysqltutorial.org site below:
http://www.mysqltutorial.org/mysql-date_format/
Nuevo comentario
Por favor, ingresa o regístrate para enviar un comentario.