Subject | Re: [firebird-support] Generic SQL question |
---|---|
Author | Alexandre Benson Smith |
Post date | 2005-05-17T07:25:55Z |
Kjell Rilbe wrote:
I understood what you want.. but really don't get why diferent results
:-( For sure we are missing some obvious point.
In fact I expect the both queries to have the same plan, and that the
optimizer will transform internally the latter into the former (at least
it will do it for IN, I expect the same for NOT IN).
Could someone shed some light on this ?
I got really curious about it...
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.10 - Release Date: 13/05/2005
>Perhaps I should add that what I want is to get all F records whose IDKjell,
>does not appear in table T (column T.ID).
>
>Kjell
>
>Kjell Rilbe wrote:
>
>
>>Just have to make sure I'm not going crazy. Please confirm that these
>>two SQL statements should return the same result:
>>
>>select count(*)
>>from F
>>where not exists (
>> select 1
>> from T
>> where T.ID = F.ID
>> )
>>
>>select count(*)
>>from F
>>where ID not in (
>> select ID
>> from T
>> )
>>
>>
I understood what you want.. but really don't get why diferent results
:-( For sure we are missing some obvious point.
In fact I expect the both queries to have the same plan, and that the
optimizer will transform internally the latter into the former (at least
it will do it for IN, I expect the same for NOT IN).
Could someone shed some light on this ?
I got really curious about it...
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.10 - Release Date: 13/05/2005