Subject Re: [Firebird-Architect] IN LIST
Author Adriano dos Santos Fernandes
= m. Th = wrote:
> 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.
>>
>>
>
> IMHO, I think that he speaks about a way to 'compress' the IN members
> from the list. (But also, at the end of his message I didn't understand
> very clear what he's saying...). On my understand the query:
>
> select * from t where id in list (1, 3, 5-10, 12);
>
> will be equivalent with
>
> select * from t where id in(1, 3, 5,6,7,8,9,10, 12);
>
In functionality, yes, but better evaluated as:
select * from t where id in (1, 3, 12) or id between 5 and 10

But again, the plus is to have a dynamic statement without the need of
EXECUTE STATEMENT.


Adriano