Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Queries give impossible results
sorry jusung,
when you have a (finite) set
- of course in this newsgroup every set is finite -
with say n elements
"count(*) = n"
and you have property P1 which is fulfilled by p1 members of the set
"(count(*) where P1) = p1"
and a property P2 which is fulfilled by p2 members of the set
"(count(*) where P2) = p2"
"count(*) where (P1 AND P2)"
MUST BE AT LEAST p1 + p2 - n
so in jakes case
n = 138295
p1 = 135324
p2 = 138292
so jake's final query which results in "4" should be at least 135321.
as jake posted , a
SELECT /*+ RULE */ count(*)
FROM ci_customer
WHERE customer_state = 'ACTIVE'
AND customer_type <> 'PERSON';
yields exactly 135321
Jusung Yang wrote:
> Maybe by now you have figured out what is going with your data and
> that ORACLE, after all, did not give you wrong results. I don't think
> ORACLE is capable of giving wrong results for simple queries like
> these.
>
>
>>Using common sense it's easy to understand that there are more >>than 4 customers that are not 'PERSON' but are 'ACTIVE'.