Skip to content
Advertisement

sql query “WHERE IN”

I have this query :

SELECT Company_Name FROM tblBeneficaries WHERE BeneficaryID IN ()

When I execute it it returns the message:

Incorrect syntax near ‘)’.

What is the problem?

Advertisement

Answer

That’s because, your IN clause has no parameter/argument WHERE BeneficaryID IN (). It should be WHERE BeneficaryID IN (id1,id2,id3, ...,idn)

Your current query is same as saying below, no need of the WHERE condition

SELECT Company_Name FROM tblBeneficaries 
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement