rayhab
03-09-2009, 07:50 PM
Hi,
I am working in MySQL.
I have a table mytable(id1, ...) and myext(id1, id2)
myext
id1 id2
-------- ---------------
1 1
1 2
1 3
2 1
2 2
2 4
3 4
3 5
3 1
4 5
Now what i want to to select ALL id1 that have an id2 of 1 AND 2.. so from teh table above, it should only return an id1 of 1 and 2. It should also work if i want it to return all id2 of 1 AND 2 AND 3 AND so on.
I am looking for the best solution to this problem.
Any help would be appreciated.
I am working in MySQL.
I have a table mytable(id1, ...) and myext(id1, id2)
myext
id1 id2
-------- ---------------
1 1
1 2
1 3
2 1
2 2
2 4
3 4
3 5
3 1
4 5
Now what i want to to select ALL id1 that have an id2 of 1 AND 2.. so from teh table above, it should only return an id1 of 1 and 2. It should also work if i want it to return all id2 of 1 AND 2 AND 3 AND so on.
I am looking for the best solution to this problem.
Any help would be appreciated.