Subject Re: Why a certain expression in 'where' throws an error?
Author kokok_kokok
Sorry, I forgot it. I have replied it in the other message.

I am not casting dates to integer. I am casting float to integer, then I sum the date and the integer and I get a date.

In any case, as I replied in the other post, the problem is in the BETWEEN because using >= and <=, it works fine.

Thank you






--- In firebird-support@yahoogroups.com, Paul Vinkenoog <paul@...> wrote:
>
> Hi kokok,
>
> > SELECT * FROM Orders
> > WHERE
> > CAST(OrderDate + CAST((LfAvgDays+0.5) AS INTEGER) AS DATE) BETWEEN '2009/1/1' AND '2010/1/1'
> >
> > OrderDate is date type. LfAvgDays is float type. Why do I get error when I execute it?
>
> Next time, please include the error message!
>
> Anyway: you can't cast dates to integers. And you don't need a cast to add a float to a date. However, it will return a date, without time part.
>
> Try:
>
> where OrderDate + round(LfAvgDates) between '2009/1/1' and '2010/1/1'
>
>
> HTH,
> Paul Vinkenoog
>