CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `util`.`eventLogGrouped` AS SELECT max(`t`.`date`) AS `lastHappened`, COUNT(0) AS `nErrors`, `t`.`event` AS `event`, `t`.`error` AS `error` FROM `util`.`eventLog` `t` GROUP BY `t`.`event`, `t`.`error` ORDER BY max(`t`.`date`) DESC