I have a table with three fields, namely id (Primary Key), start_date (Date) and no_of_days (Int). I need to fetch the results from this table in such a way that after adding no_of_days days to start_date the resultant date should be less than the current date.
For example, if we have this row in table
id start_date no_of_days
8 2011-08-19 10
If we add 10 (no_of_days) to 2011-08-19 (start_date) then the resultant date will be 2011-08-29 and it is also less than current date so this entry should be fetched.
How can I do this using a MySQL query?
Or even better, an equivalent query which can use an index on the
start_datecolumn by rearranging: