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] Iterate and write a previous row to a temp table?

2007-07-06 Thread Bob Singleton
chester c young wrote: --- Bob Singleton <[EMAIL PROTECTED]> wrote: Revisiting a Time In Status query I received help on - I'm trying to narrow down a subset of data I return for analysis. Given a statusLog as entityId, statusId, timestamp that might look something like entity

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] Quote problem

2007-07-06 Thread Bart Degryse
Consider a perl function like this CREATE OR REPLACE FUNCTION public.test(text) RETURNS VOID AS $body$ my $var = shift; spi_exec_query("INSERT INTO tbltest(field1) VALUES ('$var')"); $body$ LANGUAGE 'plperlu' VOLATILE; and a table CREATE TABLE tbltest ( field1 text ) WITHOUT OIDS; When I ca

[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; }