I want to subtract a number of days from a date. Both the date and the number of days are stored in a record but I cant figure out how to use the DATE_ADD and DATE_SUB functions using fields and not constant values. I basically need:
DATE_SUB(table.date_field, INTERVAL table.number_of_days DAY)
But this doesn't work. How can this be done?