From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
---|---|
To: | lawpoop(at)gmail(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: using subselects |
Date: | 2007-06-07 12:37:18 |
Message-ID: | 4667FBFE.3070503@magproductions.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
lawpoop(at)gmail(dot)com wrote:
> I'm creating a select list on a web form for adding a new user to a
> project. I want to select users from the user table, who aren't
> already listed in the join table under that project.
>
> Here's my select:
> SELECT * FROM users
> WHERE user_id <> $current_user_id
> AND user_id <> ( SELECT user_id FROM user_projects WHERE project_id =
> $project_id )
>
> This query returns no rows, even on projects that have no records in
> the user_projects table!
I suppose you meant to use: AND user_id NOT IN (SELECT user_id FROM ...)
Regards,
--
Alban Hertroys
alban(at)magproductions(dot)nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //
From | Date | Subject | |
---|---|---|---|
Next Message | Ray Stell | 2007-06-07 12:48:07 | Re: failing to start posgresql. |
Previous Message | Ashish Karalkar | 2007-06-07 12:31:49 | Re: failing to start posgresql. |