From: Andreas <maps.on@gmx.net>
To: pgsql-sql@postgresql.org
Subject: I need to fill up a sparse table in an view
Date: Sat, 02 Mar 2013 20:30:50 +0100
Message-ID: <5132536A.50508@gmx.net> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Hi,
I need to fill up a sparse table in an view.
The table holds some numbers relating months and objects.
The month is an integer in the format YYYYMM.
To make it more convenient to manage this table I decidet to let a value
be good till the next entry.
E.g. if there is an entry in january and march, the january entry is
good in february, too.
So the table looks like.
my_numbers ( object_id int, month int, some_nr int )
( 17, 201301, 123 ),
( 42, 201301, 456 ),
( 42, 201303, 789 ),
Now I need a view that fills the gaps up till the current month.
( 17, 201301, 123 ),
( 17, 201302, 123 ), <-- filled gap
( 17, 201303, 123 ), <-- filled gap
( 42, 201301, 456 ),
( 42, 201302, 456 ), <-- filled gap
( 42, 201303, 789 ),
Is this possible?
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
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: maps.on@gmx.net
Subject: Re: I need to fill up a sparse table in an view
In-Reply-To: <5132536A.50508@gmx.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