On 18/9/2006 16:43, "CN" <[EMAIL PROTECTED]> wrote:
> Hi!
>
> CREATE TABLE t1 (c1 text, c2 SMALLINT, PRIMARY KEY (c1,c2));
>
> CREATE TABLE t2 (a text);
>
> I am looking for a solution that will insert rows into table t1 with one
> SQL similar to this:
>
> INSERT INTO t1
> SELECT a,my_seq() FR
am Mon, dem 18.09.2006, um 15:13:10 +0800 mailte CN folgendes:
> SELECT * FROM t2 WHERE a='const_id'
>
> , then 3 records will be inserted to table t1:
>
> const_id, 1
> const_id, 2
> const_id, 3
>
> I know a PL/PGSQL function like this does the job:
You can use this:
test=# select * from t2;
Hi!
CREATE TABLE t1 (c1 text, c2 SMALLINT, PRIMARY KEY (c1,c2));
CREATE TABLE t2 (a text);
I am looking for a solution that will insert rows into table t1 with one
SQL similar to this:
INSERT INTO t1
SELECT a,my_seq() FROM t2
WHERE a='const_id'
my_seq() in SELECT clause returns a sequence of S