Mysql date calculation

software development


Ok, here’s the problem:

I have 2 columns in a table that are both int values (for example, 3 and 10). I’m passing a date into the query to calculate a starting date (say from the 3 value). Then I need to take the first calculated date and calculate an ending date. How do I refer to the first calculated date in the query?

Here’s the working query:
$query=“select mtype, mid, date_format((date_add(’$noformatstart’,INTERVAL mstart DAY)),’%m-%d-%Y’) as fstart,mstart, mspan from milestone_master order by mstart, mtype”;

I need to use fstart as the basis for another date calculation using the mspan value. I tried joining on the same table twice and using fstart as a t1 column, but that didn’t work.

Any ideas would be appreciated.