I have table Foo like:
id,
bar_1,
bar_2,
bar_3
bar1, bar2, bar3 could contain foreign key (integer) or null. I want to select all rows from Foo, where ids 2, 4 (both) are present in any two of bar1, bar2, bar3.
Simple way would be to make lot of OR's, but I believe there's simplier way.
I thought about something like
SELECT * FROM foo WHERE (2,4) IN ARRAY(bar_1, bar_2, bar_3)
Is it possible?
bar_1, bar_2, bar_3, for examplebar_1 = 2 and bar_2 = 4 or bar_1 = 4 and bar_2 = 2 or bar_1 = 4 and bar_3 = 2and so on (cartesian)