SELECT
   DISTINCT DATE_FORMAT(glpi_tickets.date, '%y%m') as period,
   DATE_FORMAT(
      MIN(glpi_tickets.date),
      '%b %Y'
   ) as 'Time period',
   COUNT(DISTINCT glpi_tickets.id) as total_ticket,
   SUM(
      IF(glpi_tickets.status = 1, 1, 0)
   ) as 'New',
   SUM(
      IF(glpi_tickets.status = 2, 1, 0)
   ) as 'Assigned',
   SUM(
      IF(glpi_tickets.status = 3, 1, 0)
   ) as 'Planed',
   SUM(
      IF(glpi_tickets.status = 4, 1, 0)
   ) as 'Waitting',
   SUM(
      IF(glpi_tickets.status = 5, 1, 0)
   ) as 'Solved',
   SUM(
      IF(glpi_tickets.status = 6, 1, 0)
   ) as 'Closed'
FROM
   glpi_tickets
   LEFT JOIN glpi_tickets_users tu ON tu.tickets_id = glpi_tickets.id
   AND tu.type = 2
   LEFT JOIN glpi_groups_tickets gt ON gt.tickets_id = glpi_tickets.id
   AND gt.type = 2
   LEFT JOIN glpi_groups_tickets gtr ON gtr.tickets_id = glpi_tickets.id
   AND gtr.type = 1
   LEFT JOIN glpi_itilcategories ON glpi_itilcategories.id = glpi_tickets.itilcategories_id
   LEFT JOIN glpi_entities ON glpi_entities.id = glpi_tickets.entities_id
WHERE
   glpi_tickets.is_deleted = '0'
GROUP BY
   period
ORDER BY
   period;