Mysql
 sql >> Database >  >> RDS >> Mysql

MySQL:esclude tutti gli utenti bloccati dai risultati

Ecco, provalo:

select * from users where user_id <> 4 and language = 'en'
    and user_id not in(select blocked_user_id from users_blocked where user_id = 4)
    and user_id not in(select user_id from users_blocked where blocked_user_id = 4)

Demo qui:http://sqlfiddle.com/#!2/b22a4/2