Skip site navigation (1) Skip section navigation (2)

Re: time series data

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: azwa(at)nc(dot)com(dot)my
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: time series data
Date: 2004-01-27 09:56:49
Message-ID: 401635E1.8040204@klaster.net (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-sql
Dnia 2004-01-27 02:42, Użytkownik azwa(at)nc(dot)com(dot)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

In response to

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2004-01-27 10:37:46
Subject: Returned due to virus; was:hi
Previous:From: azwaDate: 2004-01-27 01:42:27
Subject: Re: time series data

pgsql-sql by date

Next:From: JinNet PickerDate: 2004-01-27 10:50:30
Subject: Postgres "dblink" Help
Previous:From: Robert CreagerDate: 2004-01-27 03:23:38
Subject: Re: [SQL] Database diagram

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group