Subject Odp: [firebird-support] Select based upon date b etween two date fields
Author liviuslivius@poczta.onet.pl
Hi,

First - what error message you get?

Regards,
Karol Bieniaszewski

----- Reply message -----
Od: "idealsj@... [firebird-support]" <firebird-support@yahoogroups.com>
Do: <firebird-support@yahoogroups.com>
Temat: [firebird-support] Select based upon date between two date fields
Data: pon., wrz 15, 2014 20:40


 

Hello,


I am new to firebird so excuse the possibly stupid question.

I am trying to select based upon a few criteria, one being that a date passed in '9/15/2014' be between the values of two date fields in the firebird table. Those would be fromdatetime and todatetime.

The values in the database for those two fields respectively are '09/01/2014' and '10/23/2014'


The sql is below. It works fine until I add the BETWEEN statement. Hopefully you can point out something simple that I am doing wrong.



select description, WOReqd, Addontype as AddonTypeID, RatebookID from rentaladdons left join rentalratebook on rentaladdons.ratebookID = rentalratebook.ratebookID where addonID = '1002' and cast('09/15/2014' as date) between rentalratebook.fromdateti me and rentalratebook.todatetime