From: Tomasz Myrta <jasiek@klaster.net>
To: azwa@nc.com.my
Cc: pgsql-sql@postgresql.org
Subject: Re: time series data
Date: Tue, 27 Jan 2004 10:56:49 +0100
Message-ID: <401635E1.8040204@klaster.net> (raw)
In-Reply-To: <OF9F6AE314.E3F8364A-ONFFFFFF56.0024DC53@nc.com.my>
References: <OF9F6AE314.E3F8364A-ONFFFFFF56.0024DC53@nc.com.my>
Dnia 2004-01-27 02:42, Użytkownik azwa@nc.com.my napisał:
>
>
> Hi,
>
> thanks for the info..btw can u pls explain a little bit detail since
> i can't get thru yr solution.
> thanks in advance
insert into time_table (time_key,year_id,month_id,month_desc,day_id)
select
newid,
extract('year' from your_date),
extract('month' from your_date),
to_char(your_date,'mon'),
extract('day' from your_date)
...
from (select nextval('time_seq') as newid,
'1994-01-01'::date+'1 day'::interval * currval('time_seq') as your_date) x;
Everything you need is to execute query above as many times as you need.
Regards,
Tomasz Myrta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net, azwa@nc.com.my
Subject: Re: time series data
In-Reply-To: <401635E1.8040204@klaster.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox