在 postgres 中,您可以像这样对多个项目进行比较:
SELECT 'test' IN ('not','in','here');
这等同于:
SELECT ('test' = 'not' OR 'test' = 'in' OR 'test' = 'here');
是否有 SQL Server 的功能等效项?
最佳答案
它受支持,但您需要将表达式放在接受 bool 表达式的地方。例如,在 case
语句中:
select case when 'test' in ('not','in','here') then 1 else 0 end
-----------
0
(1 row(s) affected)
或者一个where
子句:
select * from T where C in (1,3,5,7,9)
关于sql-server - SQL Server 功能等同于 PostgreSQL "in",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/341232/