Parameter value no need to enter

Mike Hughes

Registered User.
Local time
Today, 22:11
Joined
Mar 23, 2002
Messages
493
This is the query I have:

SELECT
a.ID_CASE,
a.AMT_TXN_CUR_SUP
FROM NOLDBA_LOG_SUPPORT a
WHERE a.MTH_SUPPORT in (201007, 201008);

It returns how much CUR_SUP is owed on each ID_CASE in the past 60 days.
The CUR_SUP field is not in days it is in months.

So whenever I need to run the query I need to be sure that the past two months are entered as the parameter value.

Can someone tell me ( and show me) if there is a way to change the query so that I don’t need to enter this information whenever I run this query? In other words have the query just run for the past two months, prior to the one we are currently in.

Thanks, Mike
 
I think I found the answer myself--thanks anyway

Year([SalesDate]) = Year(Now()) And Month([SalesDate]) = Month(Now()) - 2
 
I spoke too soon. That doesn't work. Any suggestions?
 
Not completely clear on your objective but might be:

Year([SalesDate]) = Year(Date()) And Month([SalesDate]) <= Month(Date()) - 2

Copy and paste.
 
You want to use dateadd and use it either
a.MTH_SUPPORT >= Int(format(dateadd(so something here),"YYYYMM"))

Or you can use:
a.MTH_SUPPORT = int(format(dateadd(do something here), "YYYYMM"))
or a.MTH_SUPPORT = int(format(dateadd(do something here), "YYYYMM"))
 

Users who are viewing this thread

Back
Top Bottom