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;
id
-----
aaa
bbb
aaa
ccc
aaa
ddd
(6 rows)
test=*# create sequence t2_seq;
CREATE SEQUENCE
test=*# select *, nextval('t2_seq') as foo from t2 where id = 'aaa';
id | foo
-----+-----
aaa | 1
aaa | 2
aaa | 3
(3 rows)
(You should use a temp. sequence instead...)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net