Re: [firebird-support] Plan problem en CTE

2020-01-01 Thread setysvar setys...@gmail.com [firebird-support]
Your query is most likely incorrect. The LIST function returns a VARCHAR, so if x returns, say, two rows with 5 and 7, then list will create the string '5,7' (or '7,5', your query does not specify any order) and IN ('5,7') is very different from IN('5', '7'). Your query would only return rows

RE: [firebird-support] Plan problem en CTE

2019-12-31 Thread liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
HiWhy "list(x.tbl2_pk_id)"?Result of list is a blob string with one single value like '1,2,3' not a 3 records '1', '2', '3'.And using "in" is not a good choice here. Change query to e.g. 'exists' or better some 'join'Regards,Karol Bieniaszewski null

Re: [firebird-support] Plan problem en CTE

2019-12-31 Thread Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
On 2019-12-30 17:57, Germán Balbi bal...@yahoo.com [firebird-support] wrote: > Hi. > I have this problem in FB 2.5 > > with x as ( > SELECT * > FROM tbl_x1 > JOIN tbl_fk1 ON cond_1 > WHERE cond_w1 > UNION > SELECT * > FROM tbl_x1 > JOIN tbl_fk1 ON cond_2 > WHERE cond_w2 > ) > >

Re: [firebird-support] Plan problem en CTE

2019-12-30 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
30.12.2019 17:57, Germán Balbi bal...@yahoo.com [firebird-support] wrote: > How can I specify the right plan? Your strange query cannot work at all. Natural scan is unavoidable with it. -- WBR, SD.