Muhammad Nadeem Muhammad Nadeem - 8 months ago 31
MySQL Question

SQL Query to get different records from two tables

i have two tables in my DB,One is User and contains user_id, second is user_follower and this contain user_id and follower_id(user_id of other user).
i want to get user list but don't want to get those user in it that is already in user_follower table for current user.
for example i have user_id 1 and want to get user list for this, i want all user that is is not in user_followers as follower.
can some one help me in this.

i tried

select user_id from user
select user_id from user_followers

but i get error on this , it is not supported by msql

SELECT t.user_id from user t
 WHERE NOT IN(SELECT uf.user_id FROM user_followers uf
             WHERE uf.user_id = t.user_id);