Well if you want the latest and greatest iSession irrespective of the user
use

select max(iSession) from O_Sessions;

If it is to be grouped by user, then 
select user, max(iSession) from O_Sessions group by user;

This will give you the max iSession for a user.

Regards
Satish

-----Original Message-----
From: Robo [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 12:39 PM
To: [EMAIL PROTECTED]
Subject: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP
BY iUser


I want the latest (highest) iSession to be selected:

    SELECT iSession FROM O_Sessions GROUP BY iUser

Because of GROUP BY, allways the first(!) recordset for iUser is selected.
But i want the last recordset to be selected :-(

How can this be done ?
(mySQL)
(iSession ist the primary key => latest=highest. filling the primary key
from 4294967295 down to 0
does not work)

greetings from germany (getting rather dark),
roland (Bollmann)


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to