Subject | Strange results using subqueries... |
---|---|
Author | paul_kenyon |
Post date | 2011-06-20T09:26:05Z |
Hi all,
We're using Firebird 2.1.4 and I can't work out what's going on with the following queries.
The following query returns 42 records (which is correct):
select B.ID
from B
The following query returns 42 records (which is correct):
select B.ID
from B,C
where B.ID=C.BID
The following query returns 42 record (which is correct):
select A.ID
from A
where A.ID in
(
select B.ID
from B,C
where B.ID=C.BID;
)
Now the problem is that when I run the following I expect to get NO records returned (ignore the fact the query is pointless in this example):
select A.ID
from A
where not A.ID in (select A.ID from A)
and A.ID in
(
select B.ID
from B,C
where B.ID=C.BID;
)
But it still returns 42 records?!?
This worked fine in InterBase 7.1 Has anybody got any idea what's going on here?
Paul.
We're using Firebird 2.1.4 and I can't work out what's going on with the following queries.
The following query returns 42 records (which is correct):
select B.ID
from B
The following query returns 42 records (which is correct):
select B.ID
from B,C
where B.ID=C.BID
The following query returns 42 record (which is correct):
select A.ID
from A
where A.ID in
(
select B.ID
from B,C
where B.ID=C.BID;
)
Now the problem is that when I run the following I expect to get NO records returned (ignore the fact the query is pointless in this example):
select A.ID
from A
where not A.ID in (select A.ID from A)
and A.ID in
(
select B.ID
from B,C
where B.ID=C.BID;
)
But it still returns 42 records?!?
This worked fine in InterBase 7.1 Has anybody got any idea what's going on here?
Paul.