I\'ve got a monitoring system that is collecting data every n seconds (n is approximately 10 but varies). I\'d like to aggregate the collected data by 15 minute intervals.
THis Work for me
SELECT CONCAT ( YEAR(transactionDate) ,'-' ,MONTH(transactionDate) ,'-' ,DAYOFMONTH(transactionDate) ,' ' ,HOUR(transactionDate) ,':' ,((floor((MINUTE(transactionDate) / 15)) + 1) * 15) - 1 ,':59' ) AS tmp1 ,count(*) FROM tablename GROUP BY tmp1 limit 20;