mysql - 从其他表查询检查状态

标签 mysql sql

我有以下查询

select * from user_profile 

现在我想添加条件检查其他表(用户)的用户状态

select * from user_profile,users where users.status!=0

请不要推荐按照旧的加入查询加入我

谢谢

最佳答案

如果不想使用联接,则必须使用子查询。我猜两个表都有一个类似 userId:

的列
select * from user_profile where userId in (select userId from users where status != 0)

关于mysql - 从其他表查询检查状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47691528/

相关文章:

用于将 CSV 文件上传到数据库的 Java 桌面应用程序

PHP 不显示 MySQL 查询结果

asp.net - 是否有比升级到 Visual Studio 2010 Ultimate 更便宜的负载测试方法

mysql - 选择价格范围 - MySQL 查询

php - PHP 中的近似计数

mysql - 执行查询时出现 SQL 错误

mysql - 计算日期范围内的天数并求和

php - SQL将我的输入日期更改为0000-00-00,将时间更改为00:00:17

mysql - 是否可以从 php/mysql 查询将多个单元格返回到单个单元格中?

Python Pandas 使用 NaN 值写入 sql