I can't get my head round a problem...... sometimes I wish my SQL92 was as good as my PHP 
I have 3 tables each with primary keys as the *id field
table: users
uid, uname, etc....
table groups:
gid, gname, etc.....
table user_group
id, gid, uid
thus, the third table holds info on what users are in what groups using foreign key cols from the other two tables
SELECT a.uname
FROM users a, user_group b
WHERE a.uid = b.uid
AND b.gid = 0000001
will select all the users in group 000001
how do I select all the ones that aren't in the group efficiently??
All I can think of is to turn the result set from the above into an array and then use php to loop through this array to build a HUGE where clause in the form
WHERE uid <> first_array_element
OR uid <> second_array_element
........... and so on
and then execute that.
But it strikes me as very inefficient.
Is there any way of doing this within the SQL?????

I have 3 tables each with primary keys as the *id field
table: users
uid, uname, etc....
table groups:
gid, gname, etc.....
table user_group
id, gid, uid
thus, the third table holds info on what users are in what groups using foreign key cols from the other two tables
SELECT a.uname
FROM users a, user_group b
WHERE a.uid = b.uid
AND b.gid = 0000001
will select all the users in group 000001
how do I select all the ones that aren't in the group efficiently??
All I can think of is to turn the result set from the above into an array and then use php to loop through this array to build a HUGE where clause in the form
WHERE uid <> first_array_element
OR uid <> second_array_element
........... and so on
and then execute that.
But it strikes me as very inefficient.
Is there any way of doing this within the SQL?????