Subject | Re: [firebird-support] Best index for BETWEEN? |
---|---|
Author | Milan Babuskov |
Post date | 2008-10-16T13:27:11Z |
Mercea Paul wrote:
For example, I need to find the range to which the user-supplied value
belongs. Field1 and Field2 can, for example, be a starting and ending
date for some event, and I need to find to which event some date
belongs. It's a little bit more complex than that in real application,
but you get the idea.
--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com
>> In an application I'm currently developing I have a lot of parametrized100%
>> queries like this:
>
>> SELECT * FROM table1 t WHERE :somevalue BETWEEN t.field1 AND t.field2;
>
> Are you sure about this select?
For example, I need to find the range to which the user-supplied value
belongs. Field1 and Field2 can, for example, be a starting and ending
date for some event, and I need to find to which event some date
belongs. It's a little bit more complex than that in real application,
but you get the idea.
> For me looks more logic something like:That would be the easy case :)
>
> SELECT * FROM table1 t WHERE t.id_or_date BETWEEN :param1 AND :param2;
--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com