Subject | Re: [firebird-support] Weird query results - bug? |
---|---|
Author | Gary Benade |
Post date | 2013-01-18T12:30:32Z |
On 1/18/2013 2:02 PM, Kjell Rilbe wrote:
when you run the following query?
select B.*
from "Branschkod" B
inner join "Branschkod" B2 on B2."Namn" = B."Namn"
where coalesce(B."ECO_ID",'') <> coalesce(B2."ECO_ID",'')
Regards
Gary
> Den 2013-01-18 12:56 skrev Kjell Rilbe såhär:I have a feeling it my be related to nulls in ECO_ID, what do you get
>> Hi,
>>
>> This SQL returns 2533 records, none of which contain B."Kod" starting
>> with 1711 or 2111 (checked thoroughly):
>> select B.*
>> from "Branschkod" B
>> inner join "Branschkod" B2 on B2."Namn" = B."Namn"
>> where B."ECO_ID" <> B2."ECO_ID"
>>
>> Now, I add a line to the WHERE:
>> select B.*
>> from "Branschkod" B
>> inner join "Branschkod" B2 on B2."Namn" = B."Namn"
>> where B."ECO_ID" <> B2."ECO_ID"
>> and B."Kod" in ('17111', '17112', '17113', '21111', '21112', '21113')
>>
>> This select DOES return six records, containing B."Kod" starting with
>> 1711 or 2111 (one for each code in the list).
>>
>> How can this happen?
>>
> Note: I tried inserting the results of the first query into a new table.
> Then I did
>
> select *
> from newtable
> where "Kod" in ('17111', '17112', '17113', '21111', '21112', '21113')
>
> It did not return any records. Still the second select does return six
> records.
>
> Kjell
when you run the following query?
select B.*
from "Branschkod" B
inner join "Branschkod" B2 on B2."Namn" = B."Namn"
where coalesce(B."ECO_ID",'') <> coalesce(B2."ECO_ID",'')
Regards
Gary