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_e
On 8/5/05, Yudie Pg <[EMAIL PROTECTED]> wrote:
I thought simple join like this would work, but it doesn't
select * from payment P, datelist(P.date_start
, P.date_end)
try select * from payment as p, (select * from datelist('8/1/2005, 8/5/2005')) as date
where date.. = p.
try select * from payment as p, (select * from datelist('8/1/2005, 8/5/2005')) as datewhere date.. = p.
The problem is the function's parameters '8/1/2005', '8/5/2005' has to refer to whatever value on the payment records.
On Fri, 2005-08-05 at 10:53 -0500, Yudie Pg wrote:
> 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
what about something likeselect id,datelistfrom payment as p, (select * from datelist('8/1/2005, 8/5/2005')) as list
where datelist between p.date_start and p.date_end;
That's works but have to put the whole date range into the parameters before it can be joined.
This would need 2 queries whe
Yudie Pg <[EMAIL PROTECTED]> writes:
> I have a function returning set of date called datelist(date,date)
> ...
> I would like to join this function with a table
> create table payment(
> id int4 not null,
> date_start date,
> date_end date
> )
> ...
> I thought simple join like this would w
On 8/5/05, Tom Lane <[EMAIL PROTECTED]> wrote:
Certainly not --- per the SQL spec, different elements of a FROM listare independent, so the datelist relation can't refer to P.
(I think SQL 2003 has a construct called LATERAL that would allowsuch things, but we don't implement that yet.)The only wa