user3239364 user3239364 - 5 months ago 7
SQL Question

How do I get 1 year data in Jaspersoft SQL query

I am using

$(Start_Date)
and
$(end_date )
as parameters and they have a default value to show last months start and end date.

I want to subtract 1 year from the start and the end date by using a SQL query and not directly in report?

Answer

in your SQL query (from Design view, click the DataSet and Query editor icon) :

Select
 ... date_sub($(Start_Date), interval 1 year)... ,
 ...date_sub($(end_date ), interval 1 year)... 
from ...
;