Wednesday, March 7, 2012

Problem with WHERE AND OR

I have a query that is mostly working, but the second or isn't coming into play.
SELECTSUM(SLPTRANS.TimeSpent) / 3600AS Hours, CLIINFOF.AddressLine1FROM CLIINFOFINNERJOIN SLPTRANSON CLIINFOF.RecordID = SLPTRANS.ClientIDINNERJOIN CUSTOMCON CLIINFOF.RecordID = CUSTOMC.RecordIDQWHERE (SLPTRANS.ActyExpID ='417')OR (SLPTRANS.ActyExpID ='418')AND (CUSTOMC.Service_Cont ='YES')GROUP BY CLIINFOF.AddressLine1

It is taking into account the 417 and the Customc.service_cont = yes, but not the 418. Any assistance would be greatly appreciated.

Thanks!

What about this:

WHERE (SLPTRANS.ActyExpID ='417' OR SLPTRANS.ActyExpID ='418')AND CUSTOMC.Service_Cont ='YES'

No comments:

Post a Comment