Subject | RE: [Firebird-general] Creating a birthday list for Date of Birth |
---|---|
Author | Nigel Weeks |
Post date | 2005-12-21T22:02:23Z |
> How would I construct a birthday list from a list of date of births? IIf you ask this in firebird-support (where questions like this are answered
> have the ability to alter the table structure if I need to.
>
rapidly), you might have more success.
You'll probably get an answer something like:
----- example table -----
create table tbl_person (
int_person INTEGER NOT NULL,
str_name VARCHAR(100),
dtm_dob DATE,
primary key(int_person)
);
create generator gen_tbl_person;
insert into
tbl_person(int_person,str_name,dtm_dob)values(gen_id(gen_tbl_person,1),'Andy
','2005-jan-01');
insert into
tbl_person(int_person,str_name,dtm_dob)values(gen_id(gen_tbl_person,1),'Bob'
,'1970-feb-16');
insert into
tbl_person(int_person,str_name,dtm_dob)values(gen_id(gen_tbl_person,1),'Clai
re','1978-may-28');
select * from tbl_person;
INT_PERSON STR_NAME DTM_DOB
============ ======================= ===========
1 Andy 2005-01-01
2 Bob 1970-02-16
3 Claire 1978-05-28
Then, to get the parts of the DTM_DOB you want:
select str_name, extract(day from dtm_dob)||' of the '||extract(month from
dtm_dob) AS Birthday from tbl_person;
STR_NAME BIRTHDAY
================ ====================
Andy 1 of the 1
Bob 16 of the 2
Claire 28 of the 5
You've got the idea. Tinker with it to suit your needs.
N.
Nigel Weeks
Tech Support & Systems Developer
nweeks@...
www.examiner.com.au
71 - 75 Paterson Street
Launceston
Tasmania 7250
Australia
Phone: 03 6336 7234