Is there a ternary conditional operator in T-SQL?

后端 未结 2 1802
青春惊慌失措
青春惊慌失措 2021-01-30 01:25

What are alternatives to implement the following query:

select *  
from table  
where isExternal = @type = 2 ? 1 : 0
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-30 01:51

    Use case:

    select *
    from table
    where isExternal = case @type when 2 then 1 else 0 end
    

提交回复
热议问题