Anyname Donotcare
Anyname Donotcare

Reputation: 11393

Make calc on dates using informix db

I want to put the following condition in my query ,but i don't know the correct syntax in informix to do that .

At least one year passed on his work date ..

So


I try some thing like that

b.work_date - CURRENT >= 12   -- 12 month

How to do that ?

Upvotes: 0

Views: 136

Answers (2)

RET
RET

Reputation: 9188

You need to be careful with the CURRENT - 12 UNITS MONTH approach. It does not take the leap-day in February into account, and would explode with an Invalid day in date error if you ran it on 2012-04-29.

It is safer to write

b.work_date < TODAY - 365

Upvotes: 1

Filipe Silva
Filipe Silva

Reputation: 21657

You can do:

b.work_date <= CURRENT - 12 UNITS MONTH

Upvotes: 1

Related Questions