Subject Re: [firebird-support] Copying rows into tables
Author Magnus Titho
yaedos2000 schrieb am 03.03.2005 14:47:
>
>
> 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?

If the tables have the same structure the sql-statement should also work
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