tomasd Posted September 22, 2008 Share Posted September 22, 2008 Hi, Can somebody please tell me how to select tuple containing timestamp that is closest to now()? i.e. if I have data like 2008-09-18 14:31:04 2008-09-18 14:31:06 2008-09-18 14:32:04 2008-09-18 14:35:04 2008-09-18 15:31:04 How can I do select that would give me 2008-09-18 15:31:04? Quote Link to comment https://forums.phpfreaks.com/topic/125286-solved-how-to-select-latest-date/ Share on other sites More sharing options...
Mchl Posted September 22, 2008 Share Posted September 22, 2008 Are there only past timestamps in that table? If so then SELECT * FROM table ORDER BY timestampField DESC LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/125286-solved-how-to-select-latest-date/#findComment-647630 Share on other sites More sharing options...
tomasd Posted September 22, 2008 Author Share Posted September 22, 2008 Are there only past timestamps in that table? If so then SELECT * FROM table ORDER BY timestampField DESC LIMIT 1 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/125286-solved-how-to-select-latest-date/#findComment-647696 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.