Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001011

[PHP-DB] SQL problem with Oracle. Please help! From: Karsten Dambekalns (k.dambekalns <email protected>)
Date: 01/04/01

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 <email protected> wł: http://www.k-fish.de/
gpg: http://www.k-fish.de/mykeys.gpg

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>