Let's suppose I want to find out all the people who are either parent or child of an specific set of people.
I could do something like:
SELECT *
FROM people P
WHERE
P.parent_id IN ('111', 'abc', '42', '1a2b3c') OR
P.child_id IN ('111', 'abc', '42', '1a2b3c')
Is there any way in which I could avoid writing the list twice (or more times if I were looking for more columns)?
I'm looking for something like:
(...) WHERE (P.parent_id OR P.child_id) IN ('111', 'abc', '42', '1a2b3c')
I'm using Oracle, but a plain SQL solution would be appreciated too.