My MySQL tables structure is like this.
USER int id varchar username FRIEND_LIST int user_id int friend_id
For each friend relationship I inse
SELECT f1.user_id, f1.friend_id FROM friends_info f1 WHERE f1.user_id = 1 OR f1.user_id IN ( select f2.friend_id from friends_info f2 where f2.user_id = 1 ) ORDER BY user_id