Re: [GENERAL] How to join function with a table?

2005-08-08 Thread Yudie Pg
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 way

[GENERAL] How to join function with a table?

2005-08-05 Thread Yudie Pg
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

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Pascual De Ruvo
On 8/5/05, Yudie Pg [EMAIL PROTECTED] wrote: I thought simple join like thiswould 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.

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Yudie Pg
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 torefer to whatever value on the payment records.

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Ragnar HafstaĆ°
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 a table

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Yudie Pg
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 where

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Tom Lane
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 work, but it