Monday 15 August 2011

MySQL ADD_DATE for date equal to or after today -



MySQL ADD_DATE for date equal to or after today -

i want display date calculate within query if date equal or after current date. in table have 'created' field, date on deposit business relationship opened (timestamp), , 'maturity' field, number in months. calculate next maturity this:

date_add(from_unixtime(created), interval maturity month)

but when seek add together comparison:

(date_add(from_unixtime(created), interval maturity month) >= now()) next_maturity

i '01.01.1970'.

could help me please?

edit: seems need more complicated query, perhaps 1 in repeat() function implemented. so, tried this:

select *, repeat date_add(from_unixtime(created), interval maturity month) next_maturity until next_maturity >= now()) end repeat next_maturity ?n

but query doesn't work @ all, returns empty array.

here's actual illustration of want do: created '05.02.2013' , maturity '2'. need add together maturity created many times necessary next_maturity equal or after today.

mysql date

No comments:

Post a Comment