Reputation: 154
I don't know what to call this problem, that's why I need your help:)
I want to search my query with these parameters:
int2
4
5
What I want to get is:
int1
1
2
i dont want to get this:
int1
3
Table:
+------+------+
|int1 |int2 |
+------+------+
|1 |4 |
+------+------+
|1 |5 |
+------+------+
|1 |6 |
+------+------+
|2 |4 |
+------+------+
|2 |5 |
+------+------+
|3 |4 |
+------+------+
|3 |6 |
+------+------+
i want to get all int1 which have 4 and 5 in any row.
thank you:)
Upvotes: 0
Views: 48
Reputation: 7960
A solution is to use a subquery like:
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
Upvotes: 2