I am using the the following sql in MySQL terminal and it works fine.
select * from metric_measured_value where metric_id=18 and measurement_time>(now()-INTERVAL 2 year);
However, when I used it in python code, it won't work.
res = self._db.Query("""SELECT * FROM metric_measured_value
WHERE metric_id = %s
AND measurement_time>(now()-%s)""",
(metric_id, max_interval))
Here metric_id=18 and max_interval="INTERVAL 2 year"
The error message is: Truncated incorrect DOUBLE value: 'INTERVAL 2 year'
What am I doing wrong?
Thanks for you help.