I have a page that dynamically delivers various data, but when there is no query string, I want it to post the 10 most recent additions. I have a timestamp that is added when data is submitted into the database. I have it in 8 size. [timestamp(8)] What I don't know how to do is compare the timestamps, and find the 10 most recent.
SELECT * FROM tips WHERE date=???????
somewhere I need to find the 10 most recent. I also have an auto-incremented column, so the newest tips would also have the highest values in the tip_id column, so how do I select the 10 most recent ones?
SELECT * FROM tips ORDER BY date DESC LIMIT 10
Correct me if I am wrong, but that should select everything from the tips table ordered by the date descending with a limit of 10.
yep, I got it before I read this. For some reason, I had a brain fart, and completely forgot about limit, and order by. Thanks!