I need a SQL statement to select a person and their buddies and their buddies buddies
Posted on 2010-09-17
I have a table in Oracle that contains buddy list information. It contains the user's buddies. The columns are "username" and "buddy". Data looks like this (listing Mary and Sue's buddies:
I am trying to write a query that starts with a specific username and finds all of their buddies. Then I want to take the result set and find all the buddies for each person in the result set; and possibly do it once more. I would like to do this in a single SQL statement. I thought it might be a CONNECT BY query, but this isn't really a hierarchy, since everyone could be a parent and a child of everyone else.