I am trying to return the fields that have intersecting fields for a specific person. What I mean by this is
Name Friend
---- -----
Joe Sally
Joe Bill
Mary Sally
Mary Michael
Mike Joe
Bill Bill
Bill Sally
Gil Sally
Gil Bill
Gil David
Say, we want the list of people that match Joe's second column, they would have to match Sally and Bill both. So only Bill matches this criteria because Mary has one, but she doesn't have Bill. Gil has Sally and Bill, but he also has David. So only Bill should be returned. I was thinking something with INTERSECT
would work because that returns common fields but that wouldn't account for someone having more, I think. Not sure how to write a SQL query to do what I want.
Clearly stated, the list of names that have the same exact friends as Joe.