I've been reworking the parentheses on this query for a bit to no avail. Can someone point me to the particular spot that is likely causing the error? Here's the error message:
Here's the query:
SELECT
tExceptionsAll1.ID,
tExceptionsAll1.CardholderName,
PCARDS_ILL_DBO_CARD.PERSON_ID,
tExceptionsAll1.CardType,
tExceptionsAll1.Duration,
tExceptionsAll1.ExceptionType,
tExceptionsAll1.STL AS [Exp STL],
tExceptionsAll1.CL AS [Exp CL],
PCARDS_ILL_DBO_CARD.TRANS_LIMIT_AMT AS [Card STL],
PCARDS_ILL_DBO_CARD.MONTH_LIMIT_AMT AS [Card CL],
tExceptionsAll1.TerminationDate,
tExceptionsAll1.DCMNames,
tExceptionsAll1.ReminderDate
FROM PCARDS_ILL_DBO_CARD
INNER JOIN tExceptionsAll1 ON (PCARDS_ILL_DBO_CARD.CARD_ID = CLNG(tExceptionsAll1.CardID))
AND (CLNG(PCARDS_ILL_DBO_CARD.PERSON_ID) = tExceptionsAll1.CardholderUIN)
WHERE (
((tExceptionsAll1.STL)>0)
And ((tExceptionsAll1.CL)>0)
And ((PCARDS_ILL_DBO_CARD.TRANS_LIMIT_AMT)<>tExceptionsAll1.STL)
And ((PCARDS_ILL_DBO_CARD.MONTH_LIMIT_AMT)<>tExceptionsAll1.CL)
And ((tExceptionsAll1.TerminationDate) Is Null)
)
OR (
((tExceptionsAll1.TempSTL)>0)
And ((tExceptionsAll1.TempCL)>0)
And ((PCARDS_ILL_DBO_CARD.TRANS_LIMIT_AMT)<>tExceptionsAll1.TempSTL)
And ((PCARDS_ILL_DBO_CARD.MONTH_LIMIT_AMT)<>tExceptionsAll1.TempCL)
And ((tExceptionsAll1.TerminationDate) Is Null)
And ((tExceptionsAll1.ReminderDate) < getdate())
);