Subject Re: [IBO] filter on TIB_QUERY generates wrong SQL
Author Wolfgang Rohdewald
On Friday 29 December 2006 18:08, Wolfgang Rohdewald wrote:
> select
> kun.zentrale as zentrale, kun.filialeorzentrale, kun.sprache as sprache, kun.kurzname as filkurzname
> , MA
> , RL
> , MA.KUNDE as KUNDE
> , EBELEG
> from ma join kun on ma.kunde=kun.kunde
> order by kun.filialeorzentrale,kun.zentrale nulls first;
>
>
> the generated SQL is
>
> select
> kun.zentrale as zentrale, kun.filialeorzentrale, kun.sprache as sprache, kun.kurzname as filkurzname
> , MA
> , RL
> , MA.KUNDE as KUNDE
> , EBELEG
> from ma join kun on ma.kunde=kun.kunde
> ORDER BY kun.filialeorzentrale ASC
> , kun.zentrale WHERE (MA = '206128004002') ASC NULLS FIRST
> ;

this one generates correct SQL:
... as above
from ma join kun on ma.kunde=kun.kunde
where 1=1
order by kun.filialeorzentrale,kun.zentrale nulls first;


generated SQL is

from ma join kun on ma.kunde=kun.kunde
where 1=1
AND (MA = '206128004184')
ORDER BY kun.filialeorzentrale ASC
, kun.zentrale ASC NULLS FIRST
;

--
Wolfgang