Compare multiple field to single IN query I have a situation where I need to compare 3 different fields of a same table to a single IN query, eg:

SELECT unit
FROM trips
WHERE owner1,owner2,owner3 in (select id from login)


Can this be done in PostgreSQL?

Using version 9.3.4
You haven't supplied a clear definition of the problem, so I have to guess you probably mean "if any of these field values are in this list" or "if all of these field values are in this list".

Either way, you'll want to use logical array operators. The "any" case is array-overlaps, &amp;&amp;:

ARRAY[owner1,owner2,owner3] &amp;&amp; (select array_agg(id) from login)


and the "all" case is array-contains, &lt;@:

ARRAY[owner1,owner2,owner3] &lt;@ (select array_agg(id) from login)