Jump to content
Changes to the Jaspersoft community edition download ×

SQL Query problem


Recommended Posts

By: vivek srinivasan - viveksrinivasan

SQL Query problem

2003-09-29 15:10

I need to write a sql query like

select * from emp where trandate<=currentdate and trandate>=currentdate-7.

Can anyone tell me how to write a query in SQL like this?

I need this query because i will be generating reports daily and i dont want to keep changing the query daily. Does the latest version of ireport support runtime parameters for the query







By: Mark Rhodes - mrhodes2

RE: SQL Query problem

2003-09-29 15:29

replace currentdate with getdate(). I know this works in Microsoft SQL. Not sure of others.





By: Sachin Aggarwal - sk_aggarwal

RE: SQL Query problem

2003-09-29 19:16


Try doing the following.

1. Declare a parameter current_date of type Date and having expression -->new Date().Do not check "isForPrompting" checkbox.

2. Now write query something like

select * from emp where trandate<='$P!{current_date}' and trandate>='$P!{current_date}'


Hope it works


Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...