pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to use a date range in a join
2+ messages / 2 participants
[nested] [flat]
* how to use a date range in a join
@ 2007-03-12 19:01 chester c young <chestercyoung@yahoo.com>
0 siblings, 1 reply; 2+ messages in thread
From: chester c young @ 2007-03-12 19:01 UTC (permalink / raw)
To: pgsql-sql
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.
____________________________________________________________________________________
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: how to use a date range in a join
@ 2007-03-12 19:11 Andreas Kretschmer <akretschmer@spamfence.net>
parent: chester c young <chestercyoung@yahoo.com>
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Kretschmer @ 2007-03-12 19:11 UTC (permalink / raw)
To: pgsql-sql
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°
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-03-12 19:11 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-03-12 19:01 how to use a date range in a join chester c young <chestercyoung@yahoo.com>
2007-03-12 19:11 ` Andreas Kretschmer <akretschmer@spamfence.net>
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