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-21 09:37:11
Message-ID: 400E4847.1000908@klaster.net (view raw or flat)
Thread:
Lists: pgsql-sql
Dnia 2004-01-21 09:53, Użytkownik azwa(at)nc(dot)com(dot)my napisał:
>  time_key integer 	 not null default nextval('time_seq'::text)
 > Example of data in time table:
 > Time_key 	 yr_id 	  month_id 	  month_desc 	  day_id
 > 	 1999 	  1 	  Jan 	  1
 > 	 1999 	  1 	  Jan 	  2
 > 	 2000 	  1 	  Jan 	  1

Use this integer sequence and interval datatype to get date result:
your_date='1994-01-01'::date+'1 day'::integer * time_key

Now you can do whatever you want with this date - look at Postgresql 
documentation "6.8. Date/Time Functions and Operators" -> "extract"

Regards,
Tomasz Myrta

In response to

Responses

pgsql-sql by date

Next:From: Tomasz MyrtaDate: 2004-01-21 11:36:18
Subject: Re: time series data
Previous:From: azwaDate: 2004-01-21 08:53:11
Subject: time series data

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