Hi, I wrote a query
select u.user, g.group, u2g.something
from users, groups, u2g
where users.u = u2g.u and groups.g = u2g.g
that returns data like this:
user, group, something
----------------------
1 , 3, a
1 , 5, b
2 , 3, c
3 , 3, d
4 , 5, e
now I would like to limit this query in such a way that it only shows users which are both in groups 3 and 5 - so it would only return {1,3, a} , {1,5, b} for my example data.
edit: I added another column to the data because there may be an incorrect solution using a group by.
edit2: sorry, I was misled by documentation. MySQL 4.0 does not support subqueries :(
edit3: This SQL will be generated programatically for any number of groups (well, up to 20 in current specification) so I would like to avoid solutions that give me too much additional coding to do. If a solution will not be found, I will just modify the resulting .Net 1.1 DataTable, but I would like to avoid that if possible.
edit4: any new idea? Perhaps one without subqueries that includes IN (3,5)?