Try this SELECT `user_id`, `login_ip`, COUNT(`id`) AS 'connections' FROM `mysql_test` WHERE `login_datetime` BETWEEN '2012-03-19 00:00:00' AND '2012-03-19 23:59:59' GROUP BY `user_id`, `login_ip` HAVING COUNT(`id`) > 2 ORDER BY COUNT(`id`) DESC LIMIT 0, 15;
On Mar 19, 2012, at 12:06 PM, Steven Staples wrote: > SELECT `user_id`, GROUP_CONCAT(DISTINCT `login_ip`) AS 'login_ips', > COUNT(`id`) AS 'connections' > FROM `mysql_test` > WHERE `login_datetime` BETWEEN '2012-03-19 00:00:00' AND '2012-03-19 > 23:59:59' > GROUP BY `user_id` > HAVING COUNT(`id`) > 2 > ORDER BY COUNT(`id`) DESC > LIMIT 0, 15; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql