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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL command help

Status
Not open for further replies.

aftab45

Technical User
Mar 2, 2006
26
GB
Hello,

I am attempting to add a sql command to my report but I'm having some trouble with the syntax. My current report hardcodes some dates in the where clause, but what I would like to do is use some sql functions to calculate the correct date, as I intend to schedule the report when complete. So for example,

select * from tableA
where start_date_and_time >= (function to get date 30 days ago)

I tried to use datediff but kept getting an error

Failed to open a rowset
Details: 420:Driver]Unexpected extra token: (

I'm running crystal reports 9, sql server 2000.

Thanks in advance.
Aftab.
 
I'm not sure what works for your datasource, but for Oracle, I use:

{fn now()}-30

You can try now() with and without the {fn}. You could also try using "today".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top