Subject Re: select birthdays form the next several days
Author Ali Gökçen
GOD! why did you created me so lazy!!!

Here is the tested version, Chiristian..


select adi,dogum_tarihi from personel

where

dogum_tarihi between

cast( (case when extract(day from current_date)=29 and extract(month
from current_date)=2
and
not (extract(day from dogum_tarihi)=29 and extract
(month from dogum_tarihi)=2)
then 1
else extract(day from current_date) end
)
||'.'||
(case when extract(day from current_date)=29 and extract(month
from current_date)=2
and
not(extract(day from dogum_tarihi)=29 and extract
(month from dogum_tarihi)=2)
then 3
else extract(month from current_date) end
)
||'.'||
extract(year from dogum_tarihi) as date)

AND -- if current date is elapsed and bdate is not elapsed then
interpret the base date as 1 march

cast( (case when extract(day from current_date)=29 and extract(month
from current_date)=2
and
not(extract(day from dogum_tarihi)=29 and extract
(month from dogum_tarihi)=2)
then 1
else extract(day from current_date) end
)
||'.'||
(case when extract(day from current_date)=29 and extract(month
from current_date)=2
and
not(extract(day from dogum_tarihi)=29 and extract
(month from dogum_tarihi)=2)
then 3
else extract(month from current_date) end
)
||'.'||
extract(year from dogum_tarihi) as date) +
(case when extract(day from current_date)=29 and extract(month
from current_date)=2
and
not(extract(day from dogum_tarihi)=29 and extract
(month from dogum_tarihi)=2)
then 13
else 14 end)


(dogum_tarihi = birth_date, you can send any date parameter instead
of current_date system value)

As Arno said index not works here, tested! :(

Regards,

-Ali