Using Date Functions (date_add, date_sub) With Fields Instead of Constant Values

Hi,

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?

Thanks,

Michael
LVL 1
Xavior2K3Asked:
Who is Participating?
 
steelseth12Connect With a Mentor Commented:
DATE_SUB(table.date_field, INTERVAL CONCAT ( table.number_of_days, ' DAY'))
0
 
Xavior2K3Author Commented:
Thanks :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.