Re: [SQL] Inserting data in a table using sub-selects]

2004-03-10 Thread Andreas Joseph Krogh
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 10 March 2004 21:56, Marty Scholes wrote: > INSERT INTO table2 (id, content) ( > SELECT id, coalesce(title, '') || ' ' || coalesce(description, '') > FROM table1 t1); > > If you want to keep them syncrhonized, in other words, rerun

Re: [SQL] Inserting data in a table using sub-selects]

2004-03-10 Thread Marty Scholes
INSERT INTO table2 (id, content) ( SELECT id, coalesce(title, '') || ' ' || coalesce(description, '') FROM table1 t1); If you want to keep them syncrhonized, in other words, rerun the query over and over again without having to truncate table2 first or deleting all of the rows, you can: INSER

Re: [SQL] Inserting data in a table using sub-selects

2004-03-10 Thread Stephan Szabo
On Wed, 10 Mar 2004, Andreas Joseph Krogh wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, I'd like to fill one table with the contents of another table. Mye schema > is like this: > > CREATE TABLE table1( > id serial NOT NULL PRIMARY KEY, > title varchar NOT NULL, > description v