Incorrect syntax near the keyword 'in'

How can I use this mysql query in sql server?

incorrect syntax error near keyword ‘in’

select count(1) as total_record
from sms_allocation
left join sms_api_definition on sms_allocation.sms_api_definition_id = sms_api_definition.sms_api_definition_id
where if((‘1’ = 1 || ‘4,26,28,31,32,33,37,41,53,56,58,62,63,66,71,72,73,75,76,77,81’ = 81 || ‘4,26,28,31,32,33,37,41,53,56,58,62,63,66,71,72,73,75,76,77,81’ = 82),
if(‘0’!=‘0’,reseller_id in (
select reseller_id
from sms_allocation
where reseller_id in (0)),reseller_id in (
select reseller_id
from sms_allocation)
), reseller_id in (
select reseller_id
from sms_allocation
where reseller_id in (0)) and sms_allocate_to=‘Company’);

you’re going to have to explain in words what the heck that IF is supposed to be doing

right now it says “IF 1 is equal to some string is equal to some other string is equal to 82”

you may not realize it, but || in SQL Server is concatenation

the other IF is no better – it starts with “IF ‘0’ is not equal to ‘0’” which of course it always will be

okay i will try.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.