Subject Re: [firebird-support] Query help
Author Svein Erling Tysvaer
Sure it is,

select case when DateA > DateB then DateA else DateB end -
case when DateC < DateD then DateC else DateD end + 1
from ...

It's the first time I've used two case statements like this, thanks for
teaching me something new.


yartax1 wrote:
> Hi,
> Is it possible to do next query without a procedure?
> Select max(DateA,DateB)-min(DateC,DateD)+1 as days from......
> DateA and DateC are start/end dates of a month.
> DateB and DateD are start/end dates of a employee contract.
> I want to now, how many days have the contract in that month.
> Thanks.
> Yartax