我不知道如何称呼这个问题,这就是为什么我需要你的帮助:)
我想使用这些参数搜索我的查询:
int2
4
5
我想要得到的是:
int1
1
2
我不想得到这个:
int1
3
表:
+------+------+
|int1 |int2 |
+------+------+
|1 |4 |
+------+------+
|1 |5 |
+------+------+
|1 |6 |
+------+------+
|2 |4 |
+------+------+
|2 |5 |
+------+------+
|3 |4 |
+------+------+
|3 |6 |
+------+------+
我想获取任意行中包含 4 和 5 的所有 int1。
谢谢:)
最佳答案
解决方案是使用子查询,例如:
select t1.int1
from yourtable t1
inner join
(select int1
from yourtable
where int2 = 4) t2 on t1.int1 = t2.int1
where t1.int2 = 5
关于mysql - 具有多个条件的 SQL 搜索查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49558270/