php - I want to find friend relationship in mysql -


possible duplicate:
friend of friend in php/mysql?

i use mysql , php. have 2 tables :

table user:

id (int) name (varchar) 

table contain user's friend:

user_id (int) friend_id (int) 

the question : if have 2 user id, let's id = 101 , id =1000 how can know relationship between these 2 id ? id 101 friend of friend of friend id 1000 or ?

in facebook/ friendster, how come can generate

select * user inner join friends on friends.user_id = user.id  user.id = '101' , friends.friend_id = 1000 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -