Subject | Re: select birthdays form the next several days |
---|---|
Author | Ali Gökçen |
Post date | 2005-09-23T09:20:50Z |
Hi,
with index(on birthdate) using:
select name,bdate from person
where
bdate between
cast( extract(day from current_date)||'.'||extract(month from
current_date) ||'.'||extract(year from bdate) as date)
and
cast( extract(day from current_date)||'.'||extract(month from
current_date) ||'.'||extract(year from bdate) as date) + 14
-Ali
--- In firebird-support@yahoogroups.com, Christian Brümmer
<christian@b...> wrote:
with index(on birthdate) using:
select name,bdate from person
where
bdate between
cast( extract(day from current_date)||'.'||extract(month from
current_date) ||'.'||extract(year from bdate) as date)
and
cast( extract(day from current_date)||'.'||extract(month from
current_date) ||'.'||extract(year from bdate) as date) + 14
-Ali
--- In firebird-support@yahoogroups.com, Christian Brümmer
<christian@b...> wrote:
> Hi Firebird group,statement the
>
> I have a table with the name as varchar and the birthday as date.
>
> And now a simple question: how can a get with a simple SQL
> name of the people, who will have birthday within the next 14 (forit into
> example) days. Is it possible to do this in a single SQL statement?
>
> The question is easy, but the solution not, correct?
>
> I have two ideas:
>
> 1st idea: in my application, I will calculate the days and split
> months and days. In the SQL statement, I will filter theinformation
> with WHERE to check the months and days.year
>
> 2nd idea: I make a second column: birthday_calc, which has a fixed
> (2000) instead of the original birth year. So I can get the data,with a
> simple: where birthday_calc >= '2000-09-10' and birthday_calc <=
> '2000-09-24'
>
> I don't like them both, do you have another better idea?
>
> Thanks in advance
>
> Christian