Ok so here is the example query:
SELECT DISTINCT id, amount FROM tbl_recurring_payment AS t
WHERE ADDDATE(t.start_date, INTERVAL (t.period) UPPER(t.unit)) = CURDATE());
The area in question is UPPER(t.unit) where I want that expr to be treated as a mysql keyword (possible values of this column are day, week, month, year). It throws an error since it cant use the expr as a keyword. Is there anything I can do to get this to work or should I just add a check for the unit and hardcode the keyword for each possible value of unit?
NO