I have the following table structure:
For uc_users
:
id | following | Name
------------------------
1 | 2,3, | Bill
2 | 1,3, | Bob
3 | 1, | Dan
I want to find out who user id 1 is following.
I have done the following:
SELECT p.*
FROM `uc_users` p
WHERE EXISTS (SELECT 1
FROM `uc_users`
WHERE `id` = 1 AND find_in_set(id, following) > 0
)
ORDER BY id DESC
LIMIT 20;
But it's giving me all 3 users where it should only give users 2 and 3.
Can anyone help? Thanks!