How to join function with a table?

From: Yudie Pg <yudiepg(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to join function with a table?
Date: 2005-08-05 15:53:19
Message-ID: e460d0c05080508532508e41f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi everyone,
I have a function returning set of date called datelist(date,date)
example:
select * from datelist('8/1/2005, 8/5/2005');
8/1/2005
8/2/3005
8/3/2004
8/4/2005
8/5/2005
I would like to join this function with a table
create table payment(
id int4 not null,
date_start date,
date_end date
)
id | date_start | date_end
----------------------------------------
1 | 8/1/2005 | 8/2/2005
2 | 8/4/2005 | 8/6/2005
I wish I could do join that returns something like this with the function
id | datelist
------------------
1 | 8/1/2005
1 | 8/2/2005
2 | 8/4/2005
2 | 8/5/2005
2 | 8/6/2005
I thought simple join like this would work, but it doesn't
select * from payment P, datelist(P.date_start, P.date_end)
because it require a relation.
help is appreciated.
Yudie

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Hatcher 2005-08-05 16:55:55 slow update query
Previous Message Lowell.Hought 2005-08-05 15:01:13 Re: DNS vs /etc/hosts