I want to check if any of the 2 columns of my table match with result of the subquery. Currently, I'm doing SELECT ... FROM ... WHERE (var1 IN SUBQUERY OR var2 IN SUBQUERY) and it works. But those 2 subqueries are the same, so I think performance could be improved if I could check for if any of the var1 or var2 is in the SUBQUERY. Could this be done without doing the subquery twice?

I've tried something like SELECT ... FROM ... WHERE var1 OR var2 IN SUBQUERY, but this of course doesn't work, because WHERE sees it as 2 different conditions like(var1) OR (var2 IN SUBQUERY).
The query that currently works that I want to increase performance of is the below:

```
SELECT table1.id FROM table1 WHERE (table1.first IN (SELECT table2.id FROM table2 WHERE (table2.xCord BETWEEN ? AND ?) AND (table2.yCord BETWEEN ? AND ?)) OR table1.second IN (SELECT table2.id FROM table2 WHERE (table2.xCord BETWEEN ? AND ?) AND (table2.yCord BETWEEN ? AND ?)))

```

So subquery is this:

```
SELECT table2.id FROM table2 WHERE (table2.xCord BETWEEN ? AND ?) AND (table2.yCord BETWEEN ? AND ?)

```