Subject Re: unions in sub-selects
Author ben_ata
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 04:00 AM 9/02/2005 +0000, you wrote:
>
>
> >FB balks at doing a union in a subquery, e.g.:
> >
> >select * from Table1
> >where Table1_ID in (Select Table1_ID from Table2 union Select
> >Table1_ID from Table3)
>
> Yes, of course, because a union implies multiple rows and a subquery
MUST
> return 0 or 1 row.
>

You confused me here. I thought the limitation or one row on the
subquery only applies to the usage of the = operator:
WHERE table_id = ( <subquery> )

But with the IN operator it should be possible to use a subquery that
returns more then one row (but only one column of course). Actually I
just tried it and this works fine (not with the union though)

Thomas