I have a table with 5 columns that each contain a value from 1-13. I want to find those records where the same value occurs in more than one of the 5 columns. Is there a function that will handle this? So far I have this idea but am looking for an easier/faster way:
select fooID
from foo
where p1=p2 or p1=p3 or p1=p4 or p1=p5
or p2=p3 or p2=p4 or p2=p5 or p3=p4 or p3=p5 or p4=p5.
I actually have 10 columns so it will be more combinations. Any ideas for a better way.
Thanks!
select fooID
from foo
where p1=p2 or p1=p3 or p1=p4 or p1=p5
or p2=p3 or p2=p4 or p2=p5 or p3=p4 or p3=p5 or p4=p5.
I actually have 10 columns so it will be more combinations. Any ideas for a better way.
Thanks!