Subject filter on TIB_QUERY generates wrong SQL
Author Wolfgang Rohdewald
Hi,

with 4.6Bc my TIB_Query generates a wrong statement when used with
filter

Filter := 'MA=''' + FMA + '''';



the SQLQuery 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,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
;


If I say "order by by kun.filialeorzentrale,(kun.zentrale nulls first);" I get

ORDER BY kun.filialeorzentrale ASC
, (kun.zentrale) WHERE (MA = '206128004002') ASC NULLS FIRST
;

I would have expected

WHERE (MA = '206128004002')
ORDER BY kun.filialeorzentrale ASC
, kun.zentrale ASC NULLS FIRST
;

--
Wolfgang