Guardiamo ad esempio Oracle SQL, che funziona perfettamente: i datiT-SQL equivalente a Oracle SQL clausola where con più colonne
Esempio:
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
Query:
SQL> select * from test where (a, b) in (select 1, 4 from dual);
A B
---------- ----------
1 4
Ecco the sql-fiddle: http://www.sqlfiddle.com/#!4/8375e/3/0
Domanda semplice: c'è qualche equivalente in MS SQL di sopra "dove (a, b)" clausola? Mi sono guardato intorno su google, MS Docs e nulla fino a questo momento ...
http://stackoverflow.com/questions/4452539/sql-server-in-clause-with-multiple-fields – Habib
Come funziona in Oracle? È lo stesso di 'select * dal test dove a = 1 eb = 4;'? Qual è il vantaggio allora? –
N.B: '(a, b)' è chiamato "espressione del valore di riga" o una tupla. Questo potrebbe aiutare con googling. –