mysql - sql query add 1 year, less days passed in month -


i have table rows of dates, need rows 1 year:

    select date_format(cal_date, '%e %m') cal_date, price_client,  price_owner, description table cal_date <  date_add('2017-09-13' , interval 1 year)  

the result of query date rows dates 1 september 2017 until 12 september 2018.

i result 13 september 2017 until 12 september 2018.

thanks in advance

for generic format based on curdate() use

select      date_format(cal_date, '%e %m') cal_date     , price_client     , price_owner     , description  table cal_date <        date_add(date_add(last_day(date_sub(curdate(), interval 30 day), interval 1 day) ,                                          interval 1 year)  

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -