ktrinad Posted August 31, 2006 Share Posted August 31, 2006 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 Thanks, Vivek 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 Hi, 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 Sachin Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now