SQL problem with Oracle. Please help!
| From: | Karsten Dambekalns | Date: | Thu, 04 Jan 2001 17:19:05 +0000 |
| Subject: | SQL problem with Oracle. Please help! | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5598@lists.php.net to get a copy of this message | ||
Hi!
I am having trouble to get the following SQL statement to be excuted. Oracle
(8.1.5) just sits there and seems to wait.
-----snip----
select count(template) as used from gastbuch where template=1 and
not(id in (select id from gastbuch where userid=25445))
----snip-----
If I just do:
-----snip----
select count(template) as used from gastbuch where template=1
-----snip----
I get a large number, just as expected.
If I do:
-----snip----
select count(template) as used from gastbuch where template=1 and id
in (select id from gastbuch where userid=25445)
-----snip----
Oracle returns 1, which is correct.
-----snip----
select id from gastbuch where userid=25445
-----snip----
returns three numbers. If I give
the following SQL:
-----snip----
select count(template) as used from gastbuch where template=1 and id
in (123,345,678)
-----snip----
it works but I don't get the result I want. As soon as I put the not back
in, it doesn't work anymore.
So: why doesn't the not work?!? I tried about 10 different
permutations of and/not and dozens of ways to place the parentheses
(spelling?) to no effect.
I hope I did make myself clear. Please help!
Karsten
--
Why do we have to hide from the police, daddy?
Because we use emacs, son. They use vi.
-----------------------------
mailto:k.dambekalns@tu-bs.de w³: http://www.k-fish.de/
gpg: http://www.k-fish.de/mykeys.gpg