Hi Pete,
I'm using a mysql database.
What I am doing is getting just the date of the latest message left, which 
displays on a previous page.
i.e. Last message was posted: date time etc.

SELECT *, UNIX_TIMESTAMP(logged) AS logged FROM forum ORDER BY logged DESC 
LIMIT 1

I though I should be using MAX(logged) somehow, but can't get it to work.
I'll stick with the above for now.
Regards, Bob.


----- Original Message ----- 
From: "Pete" <[EMAIL PROTECTED]>

> In message <[EMAIL PROTECTED]>, Bob
> <[EMAIL PROTECTED]> writes
>>Hi,
>>I want to read the latest message left and I used this, but if the db was 
>>sorted, it would fail.
>>
>>SELECT * FROM forum ORDER BY logged DESC LIMIT 1
>>
>>logged is a TIMESTAMP(14), so I really should be looking for the highest 
>>timestamp (I think?).
>>
>>How to I select logged = highest (or most recent) ?
>>Thanks, Bob.
> 
> Depends on the DB, but if you were using MySQL, then the table would
> never be "sorted".  It would always be in the same order, with indexes
> to find things faster.  




Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to