Will this work? GROUP BY maxtime, user ORDER BY maxtime DESC
comex wrote:
I have a table: create table example(time datetime, username varchar(255)); time username 2005-06-21 15:58:02 user1 2005-06-21 14:58:02 user1 2005-06-21 11:57:51 user2 2005-06-21 10:57:51 user1 2005-06-21 09:57:51 user1 The query: select COUNT(*), username, MAX(time) as maxtime from example group by username order by maxtime desc; groups by username, and returns: COUNT(*) username maxtime 4 user1 2005-06-21 15:58:02 1 user2 2005-06-21 11:57:51 I want it, however, to return: COUNT(*) username maxtime 2 user1 2005-06-21 15:58:02 1 user2 2005-06-21 11:57:51 2 user1 2005-06-21 10:57:51 That is, do not group entries by the same user together if another user visited in between. Is this possible?
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]