pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: azwa@nc.com.my
Cc: pgsql-sql@postgresql.org
Subject: Re: time series data
Date: Wed, 21 Jan 2004 10:37:11 +0100
Message-ID: <400E4847.1000908@klaster.net> (raw)
In-Reply-To: <OF79EF187C.A5E0B2D9-ONFFFFFF50.004B0C31@nc.com.my>
References: <OF79EF187C.A5E0B2D9-ONFFFFFF50.004B0C31@nc.com.my>

Dnia 2004-01-21 09:53, Użytkownik azwa@nc.com.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



view thread (6+ messages)  latest in thread

Message-ID: <400E4847.1000908@klaster.net>
Permalink:  ../400E4847.1000908@klaster.net/
Also on:    postgresql.org/message-id/400E4847.1000908@klaster.net

 · 

reply

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: <400E4847.1000908@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