Hi,I need your help.
i have three mysql tables.
The two tables contain user\'s primary informations.
and the third table contain uses friend network.
Now i am working on the search module.
i need to search the my friends\' primary informations.
for that i have to join theese three tables.
my query for was taking more time to execute(sometime not executing)  
 
  when the no of users high ( around 1000 users. each users have 1000
thousand friends.)
i guess my table design to store the friends list is not good.
my table has three fields. first primaray key, conn_from and conn_to.
conn_from->conn_to
1->2,3,4,5,6
2->3,4,8
3->7,8,9
8->3,15,20
9->6,21
first degree friends of user1
------------------------------
2,3,4,5,6
second degree friends  of user1
-------------------------------
7,8,9
Third degree friends  of user1
------------------------------
15,20,21
i want to get all the three degree friends list using single query.
2,3,4,5,6,7,8,9,15,20,21 ( This is the requried output for the user 1)
if the no of users are high, the query length will be high.
my sample query
$query = SELECT us.user_id, us.user_name, us.first_name, us.last_name,
uc.company, uc.contact_title FROM users AS us INNER JOIN users_contacts
AS uc uc.user_id WHERE uc.contact_type=\'MAIN\' AND usr_status=\'Ok\' AND
us.user_id IN(9979,9980,9981,9982,9983,9984,9985,9986,9987,....(around
7500 ids)
)
give me your suggestions.
Thanks and Regards,
-Jag.


[Non-text portions of this message have been removed]

Reply via email to