I Have two tables,
Table1
id - BIGINT
otherKey - VARCHAR(45) <---Unique
Table2
table1ID - BIGINT
The table1ID field in table2 is the same value as the id field in Table1.
I have an array containing values corresponding to the field otherKey in Table2.
myArray = {'key1', 'key2', 'key3'}
I am trying to return all Table2 rows whose otherKey value exists in myArray. I have:
SELECT * FROM Table2 WHERE (SELECT id FROM Table1 WHERE otherKey = ANY(myArray))
But I know using '=' , means the subquery can't return multiple results.
Any suggestions would be great!
WHERE table1id IN (...subquery...)?