From: | "Alexander Farber" <alexander(dot)farber(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | select * from users where user_id NOT in (select ban_userid from banlist) |
Date: | 2006-08-17 21:02:42 |
Message-ID: | 943abd910608171402p2fb1111av251f741320341bd0@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I have this strange problem that the following statement works:
phpbb=> select user_id, username from phpbb_users
phpbb-> where user_id in (select ban_userid from phpbb_banlist);
user_id | username
---------+----------
3 | La-Li
(1 row)
But the negative one returns nothing:
phpbb=> select user_id, username from phpbb_users
phpbb-> where user_id not in (select ban_userid from phpbb_banlist);
user_id | username
---------+----------
(0 rows)
Eventhough there are 3 other users in the phpbb_users table:
phpbb=> select user_id, username from phpbb_users;
user_id | username
---------+-----------
-1 | Anonymous
3 | La-Li
4 | Vasja
2 | Alex
(4 rows)
And there is only one user (La-Li, id=3) in the phpbb_banlist:
phpbb=> select * from phpbb_banlist;
ban_id | ban_userid | ban_ip | ban_email
--------+------------+--------+-------------
1 | 3 | |
4 | | | *(at)gmail(dot)com
(2 rows)
Thank you
Alex
From | Date | Subject | |
---|---|---|---|
Next Message | Dwight Emmons | 2006-08-17 21:06:51 | Cast null string '' to integer 0 |
Previous Message | Rodion Raskolnikov | 2006-08-17 20:52:24 | problem with postgres SQL db |