evenstar7139
01-13-2009, 05:12 PM
I need to write my MySQL query so it will select rows where "date" is either today's date or yesterday's date.
|
Click to See Complete Forum and Search --> : WHERE Criteria Based on a Time Period evenstar7139 01-13-2009, 05:12 PM I need to write my MySQL query so it will select rows where "date" is either today's date or yesterday's date. Mindzai 01-13-2009, 05:21 PM Try this: SELECT * FROM mytable WHERE date > SUBDATE(NOW(), 2) or if you need strictly yesterday and today rather than last 48 hours: SELECT * FROM mytable WHERE date > DATE_SUB(CURRENT_DATE(), INTERVAL 2 DAY) evenstar7139 01-13-2009, 06:55 PM That works ^_^ And no, it doesn't have to be uber specific. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |