Using an IF function in a WHERE clause -
11-04-2004
, 06:02 PM
Hi,
I need to build a query with a WHERE clause for a Crystal report that
essentially tests for something and if true, builds the rest of the
WHERE clause one way, and if false, builds the rest another way. I
would like to be able to do something like this:
WHERE LeaseCompany.LeaseCompanyNum = '09' AND
LeaseDatabase.LeaseTerminationDate = 0 AND
OpeninvAutoSchedule.AutoSchSeqNum = 1 AND
LeaseEquipment.EquipSaleInvDate = 0 AND
IF(LeaseDatabase.LeaseMaturityDate > 20041104,
OpeninvAutoSchedule.AutoschNum = 1,
OpeninvAutoSchedule.AutoScheduleStartDate1 >=
LeaseDatabase.LeaseMaturityDate AND OpeninvAutoSchedule.AutoschNum >
1)
However when I try to run this I get an ODBC Error (right after the
first OpeninvAutoSchedule.AutoschNum it chokes). Is it possible to do
what I'm trying to do another way?
Thanks very much for any help or suggestions.
Robin |