I have table
xyz (to store the relations between user and item)
| user_id | item_id |
----------------------
An item can belong to one or more user and viceversa.
So, given the user_id = A and user_id = B how can I do a mysql query to select all the items the belong both to user A and user B?
Try this one:
SQLFiddle Demo