pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Wood <rhwood@dobber.ca>
To: pgsql-sql@postgresql.org
Subject: date interpolation
Date: Sun, 25 May 2003 17:44:25 -0400 (EDT)
Message-ID: <Pine.LNX.4.44.0305251736050.29182-100000@dobber.ca> (raw)

I am looking for a way to interpolate dates to create a nice output table.

example:

given this table:
id  | start_date | end_date
----+------------+-----------
101 | 2003-02-03 | 2003-02-05
102 | 2003-03-20 | 2003-03-24
:
:

I am looking for a SELECT to retrieve this table:
id  | date
----+------------
101 | 2003-02-03
101 | 2003-02-04
101 | 2003-02-05
102 | 2003-03-20
102 | 2003-03-21
102 | 2003-03-22
102 | 2003-03-23
102 | 2003-03-24
:
:

So far the closest solution I have come up with involves creating a dummy
table that contains a long list of dates that I can JOIN against in order 
to fill in the interpolated values.  It doesn't work very well, and gets 
slow with large tables.

any clever ideas would be appreciated.

Rob




view thread (2+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0305251736050.29182-100000@dobber.ca>
Permalink:  ../Pine.LNX.4.44.0305251736050.29182-100000@dobber.ca/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0305251736050.29182-100000@dobber.ca

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: rhwood@dobber.ca
  Subject: Re: date interpolation
  In-Reply-To: <Pine.LNX.4.44.0305251736050.29182-100000@dobber.ca>
  References: <Pine.LNX.4.44.0305251736050.29182-100000@dobber.ca>

* 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