I recently dug up some old projects and noticed that in many of those I had queries that had "a IN (expr1) OR b IN (expr1)" as a condition. Some of the time, the expression was a list of values passed via parameters, some of the time it was a SELECT expression. Most of the time the expression had potential to become computationally expensive. In few places, there were also variants where there were more than 2 columns being matched against a list of candidates (eg: a IN (...) OR b IN (...) OR c IN (...))
Somewhere between those projects and today I have given up the practice of manual query building and have turned to ORM solutions instead. However, seeking to continue improving my knowledge and skills in the field, I keep on searching for optimal solutions for both past and present problems.
Discuss which languages have which ways of representing the aforementioned problem