Good Morning everyone:
I need help figuring out what is wrong with this query. I have tried to
use the LEFT JOIN, but it doesn't solve the purpose.

This is what I am trying to run:
============
SELECT group_id,name,'SELECTED' FROM groups WHERE group_id = (SELECT
group_id FROM user_groups WHERE userid= 1) UNION
Select group_id,name,' ' FROM groups WHERE group_id != (SELECT group_id
FROM user_groups WHERE userid= 1) ORDER by group_id
=========
I get this error:
You have an error in your SQL syntax near 'SELECT group_id FROM
user_groups WHERE userid= 1) union select group_id,name

I have run the sub queries individually, and they work.

Can anyone help ? I have tried various combinations..but each time I get
the same error.
Thanks!

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to