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

Passing Dates into Where Clause

Status
Not open for further replies.

Packya

IS-IT--Management
Oct 18, 2000
29
0
0
US
I have a condition in Oracle SQL:

Field_name between :DateParameter and :DateParameter + 365

How do I do this in Crystal so that CR passes it to the SQL where clause?

 
Use:

{Field_name} >= {?DateParameter)
and
{Field_name} <= dateadd('yyyy',1,minimum({?DateParameter)
))

in the record selection criteria.

Note that I changed the 365 to just adding a year to allow for leap years.

This will pass the SQL (using Oracle 9i native connection).

-k kai@informeddatadecisions.com
 
Oooops, I had a residual MINIMUM in the previous post from my testing, use this instead:

{Field_name} >= {?DateParameter)
and
{Field_name} <= dateadd('yyyy',1,{?DateParameter)
)

in the record selection criteria.

Note that I changed the 365 to just adding a year to allow for leap years.

This will pass the SQL (using Oracle 9i native connection).

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top