Q:

MySQL Query for recent n days post

I have an sql Table say Data which has a column posttime with default value CURRENT_TIMESTAMP in YY-MM-DD H-M-S. It also has another column "Days" where N number of days is given.
I have another PHP page which gets the data from the SQL table. I want to use time() function and display only those results which are still not N days after Posttime date.
Eg- If Row1- PostTime date is 2017-05-1 03:09:09, Days is 3 days
       Row2- PostTime date is 2017-05-1 03:09:09, Days is 2 days
       User date- 2017-05-4 03:09:09

Then output should be row 1 onl.
Thanks for any help and sorry for any troubles since I'm still not fully proficient in SQL

A:

You can do:
select t.*
from t
where t.posttime > date_add(now(), interval t.days day)

