List:General Discussion« Previous MessageNext Message »
From:motorpsychkill Date:March 20 2004 1:18am
Subject:retrieving last record for all distinct users
View as plain text  
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
TIMESTAMP desc

This kind of works but it does not get the correct IP for the last
TIMESTAMP.  This seems easy enough, but I can't seem to figure this one out
today.  Can anybody see what I'm missing?  Thanks!

-m

Thread
retrieving last record for all distinct usersmotorpsychkill20 Mar
  • Re: retrieving last record for all distinct usersMichael Stassen20 Mar
  • AW: retrieving last record for all distinct usersB. Fongo20 Mar
  • RE: retrieving last record for all distinct usersMatt Chatterley20 Mar
    • RE: retrieving last record for all distinct usersMatt Chatterley20 Mar