p***@gmail.com
2007-05-10 04:50:35 UTC
Hi,
I am facing problem while excuting a mysql query. My problem is as
follows-
I have two tables object_1 and object_2.
The structure of object_1 is
object_id name address
------------ ---------- ------------
1 abc xyz
2 pqr xyz
3 lmn zzz
The structure of object_2 is
object_id tag_id
-------------- ----------
1 2
1 3
2 2
object_id is the foreign key in the table object_2
I want to find all the rows from object_1 whose tag_id is 2 and 3.
ie my result row will be
object_id name address
------------ ---------- ------------
1 abc xyz
So technically what i want to do is an intersect.But since mysql
doesnt support intersect i am not able to do it
Can anyone suggest how to go about it?
Thanks
I am facing problem while excuting a mysql query. My problem is as
follows-
I have two tables object_1 and object_2.
The structure of object_1 is
object_id name address
------------ ---------- ------------
1 abc xyz
2 pqr xyz
3 lmn zzz
The structure of object_2 is
object_id tag_id
-------------- ----------
1 2
1 3
2 2
object_id is the foreign key in the table object_2
I want to find all the rows from object_1 whose tag_id is 2 and 3.
ie my result row will be
object_id name address
------------ ---------- ------------
1 abc xyz
So technically what i want to do is an intersect.But since mysql
doesnt support intersect i am not able to do it
Can anyone suggest how to go about it?
Thanks