Subject | Re: [firebird-support] Copying rows into tables |
---|---|
Author | Magnus Titho |
Post date | 2005-03-03T14:42:54Z |
yaedos2000 schrieb am 03.03.2005 14:47:
with multiple rows.
Did you encounter any problems?
Anyway, I recommend you use the syntax
insert into table_2 (field1, field2, field3, ...) select (field1,
field2, field3, ...) from table_1 [where ...]
Magnus
>If the tables have the same structure the sql-statement should also work
>
> INSERT INTO TABLE_2 SELECT * FROM TABLE_1 WHERE ID = :SOMETHING;
>
> This works fine if ID is a primary key, as only one result is
> returned. However, ID isn't necessarily unique and there could be
> multiple rows returned. How could the above statement be re-written
> to take account of this?
with multiple rows.
Did you encounter any problems?
Anyway, I recommend you use the syntax
insert into table_2 (field1, field2, field3, ...) select (field1,
field2, field3, ...) from table_1 [where ...]
Magnus