Hi, I'm trying to find the most efficient way of "linking" members to one another in a social networking application.
Currently I link them using 2 separate fields for the members: id1, id2. So, to find people in your network you would do: WHERE id1=%ID OR id2=%ID This uses indexes inefficiently, especially when I add a JOIN to the mixture. The JOIN must really slow down the query because I use an "IF" control to get the right ID e.g.: JOIN members ON members.id=IF(social_networking.id1=%ID, social_networking.id2, social_networking.id1) I believed in my ignorance that I could just use the "SET" data type, like so: WHERE FIND_IN_SET(%ID, link) "link" being 2 integers separated by a comma: "5,19" However, SET only allows defined values :-( A "dynamic" SET data type that supported integers would be sweet, but doesn't seem to exist. Does anybody have an efficient solution to this problem? Cheers -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]