Click to See Complete Forum and Search --> : Mysql - Not Intersect


Geat
07-01-2003, 03:27 AM
I've got a lookup table that contains a list of module ids linked to user ids, and a module table that contains a list of all available modules.

I would like to, in one select statement, select everything from the module table that isn't in the lookup table for the current user.

In pseudo-sql, that's:

SELECT * FROM module m WHERE [(module_lookup.id=m.id AND user_id=current_user) doesn't exist].

I guess it's possible...

pyro
07-01-2003, 07:30 AM
Try NOT LIKE, perhaps:

SELECT * FROM table WHERE username NOT LIKE 'Pyro'

Geat
07-01-2003, 07:32 AM
It's a little bit more complex than that, but thanks Pyro!