[thelist] SELECTing and auto_increment field
Andrew Forsberg
andrew at thepander.co.nz
Thu Sep 13 19:07:50 CDT 2001
> > 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 dunno. Would it? If so, boy do I feel dumb. Okay, then what would you do
>to use that last timestamp in the (assumed) array? In other words, you've
>sorted the results, now how do you say "gimme the biggest one"?
Well after my faux pas with mysql_insert_id() I can at the least
*try* to make up for it! The LIMIT 1 would return only the latest
entry, ie: the column with the largest timestamp. So just add
whatever else to the SELECT statement that you need to retrieve
(user_id, column_this, column_that, column_blue, column_red, etc...).
> > I'm not hot enough with sql to even
>> think the above would work without testing;
>
>Me neither. That's why I'm on this list.
Jumping molehills! Jumping mountains! Hurray for evolt.org!
--
Andrew Forsberg
---
the pander - http://thepander.co.nz/
uberNET - http://uber.net.nz/
More information about the thelist
mailing list