Subject Re: [Firebird-Architect] IN LIST
Author Adriano dos Santos Fernandes
Dmitry Yemanov wrote:
> Adriano dos Santos Fernandes wrote:
>
>> Hence, a way to pass indeterminate number of intervals is very great:
>> select * from t where id in list '5-10,20-30,50'
>>
>
> Do we speak about lists or ranges or both? IMO, the syntax should be
> clear about that.
>
A list of ranges and items.

>
>> And I see this syntax as a complement to FB2.1 LIST aggregate function,
>> i.e. result of LIST can be passed to IN LIST. Example:
>> select list(id) from t into :ids;
>> for select * from t where id in list :ids ...
>>
>
> 1) What will be a complement for:
> select list(id, '$') from t into :ids
> ?
>
The complete syntax may be: IN LIST w [DELIMITED BY x [AND y]] [ESCAPE z]
w is the list, x is the items separator, y the range separator and z an
escape.

> 2) Why is it better than a simple:
>
> for
> select * from t
> where id in ( select ... )
> ?
>
> I.e. why would you need an intermediate step?
>
This requires inserting in a temp table and don't work for ranges.


Adriano