Warning: #1292 Incorrect datetime error when using DATE_ADD() Doing this works fine:
SELECT * FROM table WHERE foo &lt; '2021-01-09 00:00:00'
But this one:
SELECT * FROM table WHERE DATE_ADD('foo', INTERVAL 5 DAY) &lt; '2021-01-09 00:00:00'
results in
Warning: #1292 Incorrect datetime value: 'foo'
What could possibly be causing this?
(MariaDB 10.4.17)
You try to add to the string 'foo' 5 days.
Use backticks for column names
SELECT * FROM table WHERE DATE_ADD(`foo`, INTERVAL 5 DAY) &lt; '2021-01-09 00:00:00'