ludah Posted January 12, 2015 Share Posted January 12, 2015 Please I want get data from mysql; 1. The last 24 hours. 2 the last 7 days 3. the last Months 4. Last 12 hoursplease try and help me Link to comment https://forums.phpfreaks.com/topic/293881-how-to-select-the-last-24-hours-from-a-table-with-datatime-column/ Share on other sites More sharing options...
Barand Posted January 12, 2015 Share Posted January 12, 2015 SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 24 HOUR SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 7 DAY SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 1 MONTH SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 12 HOUR Link to comment https://forums.phpfreaks.com/topic/293881-how-to-select-the-last-24-hours-from-a-table-with-datatime-column/#findComment-1502729 Share on other sites More sharing options...
ludah Posted January 12, 2015 Author Share Posted January 12, 2015 Thank you very much Link to comment https://forums.phpfreaks.com/topic/293881-how-to-select-the-last-24-hours-from-a-table-with-datatime-column/#findComment-1502732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.