RE: retrieving last record for all distinct users

2004-03-20 Thread Matt Chatterley
'mysql' Subject: RE: retrieving last record for all distinct users Making the assumption that you are running a version of MySQL which supports subqueries, I believe you could use: SELECT Login, TimeStamp, IP FROMSessions S INNER JOIN ( SELECT M

RE: retrieving last record for all distinct users

2004-03-20 Thread Matt Chatterley
-Original Message- From: motorpsychkill [mailto:[EMAIL PROTECTED] Sent: 20 March 2004 01:18 To: mysql Subject: retrieving last record for all distinct users I have a table SESSIONS with the following fields: SESSION_ID LOGIN IP TIMESTAMP I am tryin

AW: retrieving last record for all distinct users

2004-03-20 Thread B. Fongo
20. März 2004 02:18 An: mysql Betreff: retrieving last record for all distinct users I have a table SESSIONS with the following fields: SESSION_ID LOGIN IP TIMESTAMP I am trying to select the last login record for all distinct users. The closest I can get to is:

Re: retrieving last record for all distinct users

2004-03-19 Thread Michael Stassen
First, since you group by LOGIN, you don't need DISTINCT. The problem is that GROUP BY is designed for use with aggregate functions, not individual rows. So which values of SESSION_ID, IP, and TIMESTAMP you should get is undefined. The manual gives 3 solutions to this problem:

retrieving last record for all distinct users

2004-03-19 Thread motorpsychkill
I have a table SESSIONS with the following fields: SESSION_ID LOGIN IP TIMESTAMP I am trying to select the last login record for all distinct users. The closest I can get to is: select distinct LOGIN, TIMESTAMP, IP from SESSIONS group by LOGIN order by TIMES