Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a month from a calculation as a condition

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
I'm currently pulling my hair out trying to figure this one out so any help will be appreciated.

Basically I'm running a report that includes a date of death field, I want to run the report on a monthly basis and each month it should only include items that have a <date of death> month of 9 months ago or six monthly periods thereafter.

I have a <current date> field which i have created and was hoping to use Timestampdifference{<current date>, <date of death>} to calculate the number of months before the report ran.... This gives a returns type incompatible with user object type error..... Arrggghhhhh

 
Can you put a condition on the query itself, something along this line:

Where <date of death> between (Sysdate - 9) and (Sysdate - 3)

I use something like this on Oracle and it works great. Your syntax will vary depending on the database you are working with.
 
Hi,

I think blom0344 might have something to put in here. I think he is working on DB2 and might be able to give a better solution. But no matter which DB you are in you should be having some kinda Date/Time Functions to get the required Month Values based on Current Date.

Sri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top