Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL IN operator for multiple columns from different tables

Tags:

sql

oracle

I have an oracle 11.2 database and need the following query:

SELECT * FROM table1 a, table2 b
WHERE a.id = b.a_id AND (a.a_col1, b.b_col1) in ((?, ?), (?, ?), (?, ?))

Please note, that the values don't matter, I am interested in the structure of such a query. I am going to execute the query from java, passing parameters.

UPDATE: well, it actually works. I hope someone needs this information one day...

like image 570
user1414745 Avatar asked Oct 21 '22 00:10

user1414745


1 Answers

Ohhh, yes, my query actually works! I forgot some brackets when I tried it in TOAD. I wrote it correctly here!

like image 60
user1414745 Avatar answered Oct 23 '22 17:10

user1414745