Question

I am trying to run a query within Business Objects Universe Designer and I need help with the 'Where' clause.

I want to search for all records that have a 4 digit year (the DB column is in YYYY) less than or equal to 3 years from the current year. So if the year is 2014, I would like to search for every record with a year less than or equal to 2011.

Here is my current where clause:

dbo.DB_TABLE.CATEGORY = 'Actual' and dbo.DB_TABLE.YR <= (convert (SMALLDATETIME, {fn CURDATE()})-3)

Under the 'Date' function, Universe Designer only has: convert (SMALLDATETIME, {fn CURDATE()})

Thanks in advance!!!

Was it helpful?

Solution

Since yr is just a number, you only need to extract the year from the current date:

dbo.DB_TABLE.YR <= datepart(year,{fn curdate()})-3

When writing a SQL statement in the SELECT or WHERE boxes in Designer, you are not limited to only using the functions available in the list box. Any SQL that is valid for the database can be used. The list box is only a helper, and lists commonly-used functions and statements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top