SQL: Can I negate a condition in a where clause?

后端 未结 5 803
栀梦
栀梦 2021-01-13 00:28

I want to check if a boolean is true, then decide in the WHERE clause what condition to use.

Say the boolean variable is @checkbool:

SELECT *
FROM Ta         


        
5条回答
  •  不知归路
    2021-01-13 00:46

    You can use IN clausule or even the != operator, like:

    A.Id NOT IN (123,x,y,z);
    

    or

    A.Id != 123;
    

提交回复
热议问题