vinay_forum Posted October 12, 2009 Share Posted October 12, 2009 I need to fetch the last 24 hours record from my table. Need help on this.. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/177411-fetching-last-24-hours-records-from-db/ Share on other sites More sharing options...
kickstart Posted October 12, 2009 Share Posted October 12, 2009 Hi Do you have a date field on the table? What is the structure of the table? All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/177411-fetching-last-24-hours-records-from-db/#findComment-935444 Share on other sites More sharing options...
xsist10 Posted October 12, 2009 Share Posted October 12, 2009 Are you storing a datetime field or a timestamp field? If so you can select on that. SELECT [fields] FROM [table] WHERE [datetime_field] > NOW() - INTERVAL 24 HOUR ORDER BY [datetime_field]; If not then you're out of luck. You could potentially look at your bin logs but it would be much easier to just add a field. Quote Link to comment https://forums.phpfreaks.com/topic/177411-fetching-last-24-hours-records-from-db/#findComment-935453 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.