I have tried the following among various other statements but thought one of these should obviously work but no luck so far. Please tell me what I’m doing wrong. Not getting an error, it’s just not working.
DELETE FROM table_name WHERE from < NOW()
DELETE FROM table_name WHERE from < '2022-04-16 08:00:00'
Example
Advertisement
Answer
You shouldn’t name your columns (or other database objects) using reserved SQL keywords such as FROM
. That being said, both of your queries are valid once we escape the from
column:
DELETE FROM table_name WHERE `from` < NOW(); DELETE FROM table_name WHERE `from` < '2022-04-16 08:00:00';