USE foobar; SELECT From_unixtime(Truncate(Unix_timestamp(entry_date) / 300, 0) * 300) AS "every_5_mins", t2.transactionId, t1.eventName, COUNT(*) FROM logs t1 LEFT JOIN foobar.logs t2 ON t2.transactionId = t1.transactionId AND t2.eventType = "done" WHERE t1.eventName = "register" GROUP BY every_5_mins
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)