Current_date minus constant!!

Database
Enthusiast

Current_date minus constant!!

Hi!

I get a syntax error - expected something between minus and Select. What I am trying to do here is :
I have a constant stored in table2 and I want to subtract that constant from todays date. If the CLK_DT in table1 is greater than/equal to the subtraction result, then I want to pick up those records.

sel * from table1 a
WHERE a.CLK_DT >= ( CURRENT_DATE MINUS (SELECT CAST(VAL AS INT) FROM table2
WHERE CD='ABCD' ) )

Any suggestions on how to achieve this?

Thanks!!!
3 REPLIES
Senior Apprentice

Re: Current_date minus constant!!

Why don't you simply write "-" instead of MINUS?

Happy New Year :-)

Dieter
Enthusiast

Re: Current_date minus constant!!

I had written "-" earlier but that did not work too...so just to be more specifc I wrote MINUS.
Can you help me with this?
Enthusiast

Re: Current_date minus constant!!

I got the solution ..just moved date function inside the Sel clause.....thank you!