Subject | Copy records |
---|---|
Author | Planles |
Post date | 2004-08-05T09:48:21Z |
Hi all,
I'm pretty new to firebird (and databases at all), so execuse me, if this is
to basic question for this forum.
I have two tables, master and detail. Each record in master table can have
multiply records in detail table.
Now I want to make a copy of record in master table (with new id of course),
and at the same time copies of all records in detail table, which refers to
the record from master table.
Example:
Master:
ID1,Name1,Town1,...
Detail
ID1,Order1,Desc1,...
ID1,Order2,Desc2,...
ID1,Order3,Desc3,...
After copy of record ID1 from master I want to get:
Master:
ID1,Name1,Town1,...
ID2,Name1,Town1,...
Detail
ID1,Order1,Desc1,...
ID1,Order2,Desc2,...
ID1,Order3,Desc3,...
ID2,Order1,Desc1,...
ID2,Order2,Desc2,...
ID2,Order3,Desc3,...
Is there a simple way to do this ?
Regards,
Primoz
I'm pretty new to firebird (and databases at all), so execuse me, if this is
to basic question for this forum.
I have two tables, master and detail. Each record in master table can have
multiply records in detail table.
Now I want to make a copy of record in master table (with new id of course),
and at the same time copies of all records in detail table, which refers to
the record from master table.
Example:
Master:
ID1,Name1,Town1,...
Detail
ID1,Order1,Desc1,...
ID1,Order2,Desc2,...
ID1,Order3,Desc3,...
After copy of record ID1 from master I want to get:
Master:
ID1,Name1,Town1,...
ID2,Name1,Town1,...
Detail
ID1,Order1,Desc1,...
ID1,Order2,Desc2,...
ID1,Order3,Desc3,...
ID2,Order1,Desc1,...
ID2,Order2,Desc2,...
ID2,Order3,Desc3,...
Is there a simple way to do this ?
Regards,
Primoz