From: Andreas Kretschmer <akretschmer@spamfence.net>
To: pgsql-sql@postgresql.org
Subject: Re: how to use a date range in a join
Date: Mon, 12 Mar 2007 20:11:19 +0100
Message-ID: <20070312191119.GA4578@KanotixBox> (raw)
In-Reply-To: <208535.83136.qm@web54314.mail.yahoo.com>
References: <208535.83136.qm@web54314.mail.yahoo.com>
chester c young <chestercyoung@yahoo.com> schrieb:
> trying to do something like
>
> select d.day,
> c.name
> from [dates between day1 and day2] d
> left join c.some_table;
>
> but cannot figure out what to put into the brackets.
Perhaps something like this:
test=# select current_date + (generate_series(1,10)||'day')::interval;
?column?
---------------------
2007-03-13 00:00:00
2007-03-14 00:00:00
2007-03-15 00:00:00
2007-03-16 00:00:00
2007-03-17 00:00:00
2007-03-18 00:00:00
2007-03-19 00:00:00
2007-03-20 00:00:00
2007-03-21 00:00:00
2007-03-22 00:00:00
(10 rows)
If not, sorry, then please define your problem.
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
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: akretschmer@spamfence.net
Subject: Re: how to use a date range in a join
In-Reply-To: <20070312191119.GA4578@KanotixBox>
* 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