I’m trying to write a SQL query to subtract exactly 24 hours from the current time (it’s for the WHERE clause so the query only returns results from the last 24 hours). The reference materials suggest that
DATE_SUB(NOW(),1)
should work, but it doesn’t. I’ve tried casting 1 to a date, to a time, to a timestamp, but nothing seems to be working.
Just tested and a correct syntax that works is DATE_SUB(CURRENT_DATE,1)
1 Like
Works! Thank you
1 Like