Subject RE: [firebird-support] selecting any day older than some day with between
Author Svein Erling Tysvær
>Hello, I'm using FB 2.5
>In the manual says that the date type goes from 01-01-100 to 31-12-9999
>so, can I be *sure* that this select will bring all records older than a given date?
>select * from my_table where my_date between '01-01-100' and :some_date
>I'm using between and not my_date < :some_date because it's a genereic select inside a SP and sometimes I need the "from_date"

In similar situations, Sergio, I sometimes use

select * from my_table where my_date between coalesce(:from_date, my_date-1) and :some_date

Then, you just set :from_date to NULL if you want no starting date. Though I don't think this will use any index for the my_date field, so I hope you either have small tables or other indexed fields in your where clause.