Subject Re: [firebird-support] select ... in (select ... union select ...)
Author Svein Erling Tysvaer
In Fb 1.5 you have to modify your statement to

select * from table1
where exists(select * from table2 where table1.col1 = table2.col1)
or exists(select * from table3 where table1.col1 = table3.col1)

In Firebird 1.0, IN <subselect> was hopelessly slow (the subselect would
be calculated as many times as there are rows in table1), but Firebird
1.5 translated these into EXISTS where possible so that one could choose
whether one preferred EXISTS or IN to a larger extent.

Set

grostoon wrote:
> Hello everbody and happy new year,
>
> I've just found that an SQL query like
> select * from table1 where table1.col1 in (select table2.col1 from table2 union select table3.col1 from table3)
> is not supported by FB 1.5.3 and produces the following error :
>
> Statement failed, SQLCODE = -104
> Dynamic SQL Error
> -SQL error code = -104
> -Token unknown - line 1, char xxx
> -union
>
> Is this a known FB SQL syntax limitation ?
> Does this kind of request work with FB2 ?*
> Could it be possible to have it supported in final FB 1.5.4 ?
>
> Best regards,
>
> Toon.