Your table is not normalised, and will always cause you problems.
Friends should be {uid1, uid2}, and each field should contain just ONE id number. but they should also form a joint key for the table, so that 10,12 is the key to one row, and 10,53 is the key to the next row and 10,9 is the joint key to the third row.
The data returned by your sub query is the single STRING 12,53,9 and you are comparing the INT uid with this string. (I assume it's an int).
Bookmarks