I have the following query that works in MySQL:
SELECT 'DEMO' client, COUNT(*) n, SUM(PYMT_Total_Paid) actual
FROM Payments
WHERE (PYMT_CLIENT1,PYMT_CLIENT2) IN (('DEMO','SL'))
AND PYMT_DTEPYD ='20150825'
AND PYMT_MISC IN ('PY','RC','ER','RG','SP','BN','BS','SB')
AND PYMT_BEEN_REVERSED != 'Y'
When I run it in MSSQL it fails with this message:
An expression of non-boolean type specified in a context where a condition
is expected, near ','.
If I remove (PYMT_CLIENT1,PYMT_CLIENT2) IN (('DEMO','SL')) AND
from the query it runs fine. So it appears MSSQL expects a different syntax than MySQL when searching on composite keys using an IN clause.
Any pointers on where to find the correct syntax or what the correct syntax is would be highly appreciated. Thanks!
EDIT
The case I provided is oversimplified. Solution should also works if the query would have several pairs in the IN clause, e.g. ... IN (('DEMO","SL"),("ED","AUTO"),("ED","PHOTO"))