timv
March 11th, 2005, 05:29 AM
i have two table: groups and groups_invisible
table def+data: groups_invisible
+---------+----------+
| user_id | group_id |
+---------+----------+
| 100 | 4 |
| 100 | 5 |
| 100 | 6 |
+---------+----------+
table def+data: groups
+----------+---------------+
| group_id | group_name |
+----------+---------------+
| 2 | leverancier |
| 3 | klant |
| 4 | claim |
| 5 | sample |
| 6 | communication |
+----------+---------------+
Now, my query is
SELECT groups.group_id , group_name FROM alba03.groups
WHERE groups.group_id not in (select group_id from alba03.groups_invisible where user_id=100)
but mysql gives an error at the first '('
These queries do work:
1. SELECT groups.group_id , group_name FROM alba03.groups
WHERE groups.group_id not in (4,5,6)
--> returning (1,2,3)
2. select group_id from alba03.groups_invisible where user_id=100
--> returning (4,5,6)
So both parts of the query seem to work but the query itself not...
What did i do wrong?
table def+data: groups_invisible
+---------+----------+
| user_id | group_id |
+---------+----------+
| 100 | 4 |
| 100 | 5 |
| 100 | 6 |
+---------+----------+
table def+data: groups
+----------+---------------+
| group_id | group_name |
+----------+---------------+
| 2 | leverancier |
| 3 | klant |
| 4 | claim |
| 5 | sample |
| 6 | communication |
+----------+---------------+
Now, my query is
SELECT groups.group_id , group_name FROM alba03.groups
WHERE groups.group_id not in (select group_id from alba03.groups_invisible where user_id=100)
but mysql gives an error at the first '('
These queries do work:
1. SELECT groups.group_id , group_name FROM alba03.groups
WHERE groups.group_id not in (4,5,6)
--> returning (1,2,3)
2. select group_id from alba03.groups_invisible where user_id=100
--> returning (4,5,6)
So both parts of the query seem to work but the query itself not...
What did i do wrong?