In postgres you can do a comparison against multiple items like so:
SELECT 'test' IN ('not','in','here');
Which is the same as doing:
SELECT ('test' = 'not' OR 'test' = 'in' OR 'test' = 'here');
Is there a functional equivalent for SQL Server ?
It is supported, but you will need to put the expression somewhere that accepts a boolean expression. For example, in a case statement:
select case when 'test' in ('not','in','here') then 1 else 0 end
-----------
0
(1 row(s) affected)
Or a where clause:
select * from T where C in (1,3,5,7,9)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With