Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL-从结果中排除所有被阻止的用户_Mysql_Sql - Fatal编程技术网

MySQL-从结果中排除所有被阻止的用户

MySQL-从结果中排除所有被阻止的用户,mysql,sql,Mysql,Sql,我有点被MySQL查询卡住了: 我有表格用户 和表用户被阻止 其中用户\u id已阻止\u用户\u id 我想找到除我之外所有说英语的用户,恩,我没有阻止他们,他们没有阻止我。 它应该只返回上面示例中ID为3的用户 我正在建立一个语言合作伙伴搜索,它将所有被阻止的用户从搜索结果中排除。这里,尝试一下: select * from users where user_id <> 4 and language = 'en' and user_id not in(select blo

我有点被MySQL查询卡住了:

我有表格用户

和表用户被阻止

其中用户\u id已阻止\u用户\u id

我想找到除我之外所有说英语的用户,恩,我没有阻止他们,他们没有阻止我。 它应该只返回上面示例中ID为3的用户

我正在建立一个语言合作伙伴搜索,它将所有被阻止的用户从搜索结果中排除。

这里,尝试一下:

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)
此处演示:

此处,试一试:

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)
此处演示:

此处,试一试:

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)
此处演示:

此处,试一试:

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)

此处演示:

此数据集上的“是”。。如果你有很多记录,它就无法扩展。。检查视图执行计划。对于此数据集上的可伸缩性,那些依赖子查询和完整子查询都是坏消息。。如果你有很多记录,它就无法扩展。。检查视图执行计划。对于此数据集上的可伸缩性,那些依赖子查询和完整子查询都是坏消息。。如果你有很多记录,它就无法扩展。。检查视图执行计划。对于此数据集上的可伸缩性,那些依赖子查询和完整子查询都是坏消息。。如果你有很多记录,它就无法扩展。。检查视图执行计划那些依赖的子查询和FULL对于可伸缩性来说是个坏消息