[thelist] SELECTing and auto_increment field

Andrew Forsberg andrew at thepander.co.nz
Thu Sep 13 18:33:00 CDT 2001


>To do that, wouldn't I have to check a row, save the timestamp, then check
>the next row and compare the timestamp of it to the one in the last row,
>until I've been through the entire table looking for the highest timestamp?

Wouldn't it just be a

SELECT  id, whatever_else, unix_timestamp(your_col)  AS time
FROM your_table
ORDER BY time DESC LIMIT 1

I haven't checked the syntax, and I'm not hot enough with sql to even 
think the above would work without testing; but you do just need the 
highest unix timestamp value, and something like the above should get 
it.


-- 
Andrew Forsberg
---
the pander - http://thepander.co.nz/
uberNET - http://uber.net.nz/




More information about the thelist mailing list