让我们看一下完美运行的 Oracle SQL 示例:
样本数据:
SQL> create table test (a number, b number);
SQL> insert into test values(1, 1);
SQL> insert into test values(1, 2);
SQL> insert into test values(1, 3);
SQL> insert into test values(1, 4);
SQL> insert into test values(1, 5);
SQL> insert into test values(2, 1);
SQL> insert into test values(2, 2);
SQL> insert into test values(2, 3);
SQL> insert into test values(2, 4);
SQL> insert into test values(2, 5);
SQL> insert into test values(4, 1);
SQL> select * from test;
A B
---------- ----------
1 1
1 2
1 3
1 4
1 5
2 1
2 2
2 3
2 4
2 5
4 1
询问:
SQL> select * from test where (a, b) in (select 1, 4 from dual);
A B
---------- ----------
1 4
这是 sql-fiddle:http ://www.sqlfiddle.com/#!4/8375e/3/0
简单的问题:上面的“where (a, b)”子句在 MS SQL 中是否有任何等价物?我一直在谷歌、MS Docs 中四处寻找,到目前为止什么都没有……