for a basic SQL command via PHPMyAdmin in MySQL I want to select items more than 1 day old. I’m getting a basic error saying that there’s a SQL syntax error, but can’t tell what I’m doing wrong here:
COMMAND:
select *
from table_name
where column_name < Date_Add(day, -1, GetDate())
and user_id = 1
and column_name <> '0000-00-00 00:00:00'
ERROR:
#1064 - You have an error in your SQL syntax; check the manual for the right syntax to use near '-1, GetDate()) and user_id = 1 and column_name <> '0000-00-00 00:00:00' LIMI' at line 3
Any clues? Thx!!
I was thinking the syntax here is DATE_ADD.
Ok here is from the 5.0 reference guide:
Try using NOW() for the error.