guyfromfl Posted March 30, 2011 Share Posted March 30, 2011 Does anybody know how to do something like: SELECT * FROM tbl WHERE insertDate IS BETWEEN NOW AND LAST THURSDAY Link to comment https://forums.phpfreaks.com/topic/232127-selecting-everything-between-now-and-last-thursday/ Share on other sites More sharing options...
guyfromfl Posted March 30, 2011 Author Share Posted March 30, 2011 For other inquiring minds: SELECT * FROM tabl WHERE dateField >= CONCAT( DATE_SUB(CURDATE(), INTERVAL WEEKDAY(DATE_SUB(CURDATE(), INTERVAL 5 DAY)) DAY), ' 00:00:00'); Then change the interval number to whatever day of the week you want. Link to comment https://forums.phpfreaks.com/topic/232127-selecting-everything-between-now-and-last-thursday/#findComment-1194050 Share on other sites More sharing options...
gizmola Posted March 30, 2011 Share Posted March 30, 2011 I wrote an article about a very similar subject: http://www.gizmola.com/blog/archives/99-Finding-Next-Monday-using-MySQL-Dates.html Link to comment https://forums.phpfreaks.com/topic/232127-selecting-everything-between-now-and-last-thursday/#findComment-1194196 Share on other sites More sharing options...
guyfromfl Posted March 30, 2011 Author Share Posted March 30, 2011 That article is AWSOME. Perfect for what I want to do. I just need to go backwards! WAY cleaner than my solution. Thanks a million! Link to comment https://forums.phpfreaks.com/topic/232127-selecting-everything-between-now-and-last-thursday/#findComment-1194357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.