Skip to content
Advertisement

Getting an error using EXISTS operator but correct result with IN operator in

enter image description hereI am getting an error An expression of non-Boolean type specified in a context where a condition is expected while using EXISTS But when I am using IN operator it is giving the correct result.

Below is enter image description hereboth query

Advertisement

Answer

EXISTS is a unary operator, not a binary operator, and takes only a subquery as its argument. You say:

not

Since EXISTS merely tests whether the subquery would return at least one row, the fields selected are not relevant and people commonly do:

though selecting null or any other value or multiple values works just the same.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement