Re: [SQL] select from table and add rows.

2007-07-06 Thread Andrew Sullivan
On Fri, Jul 06, 2007 at 05:35:39PM +0100, Gary Stainburn wrote: > > I want to be able to do away with the first line of the code, and create a > select statement that would generate the three rows first, followed by the > rows from the table I'm using. I want to be able to do the same job withou

Re: [SQL] select from table and add rows.

2007-07-06 Thread Jon Sime
Gary Stainburn wrote: On Friday 06 July 2007 16:02, Andrew Sullivan wrote: On Fri, Jul 06, 2007 at 02:25:08PM +0100, Gary Stainburn wrote: This sets up an array with some pseudo values and then populates it with *proper* values from a table. How's the best way to do this all within SQL. I'm o

Re: [SQL] select from table and add rows.

2007-07-06 Thread Gary Stainburn
On Friday 06 July 2007 16:02, Andrew Sullivan wrote: > On Fri, Jul 06, 2007 at 02:25:08PM +0100, Gary Stainburn wrote: > > This sets up an array with some pseudo values and then populates it with > > *proper* values from a table. > > > > How's the best way to do this all within SQL. > > I'm obvious

Re: [SQL] select from table and add rows.

2007-07-06 Thread Andrew Sullivan
On Fri, Jul 06, 2007 at 02:25:08PM +0100, Gary Stainburn wrote: > This sets up an array with some pseudo values and then populates it with > *proper* values from a table. > > How's the best way to do this all within SQL. I'm obviously not understanding the question properly, because I think you

[SQL] select from table and add rows.

2007-07-06 Thread Gary Stainburn
Hi folks. In PHP I often do things such as: $wpartners=array('all'=>'All','sel'=>'Current','mine'=>'Mine'); foreach( loadhash("select p_id as key, p_name as value from partners order by p_name" ) as $key=>$dets) { $wpartners[$key]=$dets; }

[SQL] select from table

2000-06-29 Thread Kovacs Zoltan Sandor
I would like to do something like this: create function x(varchar) returns setof int4 as 'select * from $1;' language 'sql'; Unfortunately, the parser drops me back: I cannot use any parameters after the keyword "from". How to solve this? A solution in PL/PgSQL would be also nice. Thanks in adv