Re: [SQL] matching rows differing only by fkey,pkey

2004-06-22 Thread Richard Huxton
Bruno Wolff III wrote: On Tue, Jun 22, 2004 at 13:40:03 -0400, Matthew Nuzum <[EMAIL PROTECTED]> wrote: The end result is to duplicate the data for a particular record in table "a" so that all of it's related data in tables "b" and "c" is duplicated. Where "b" is the middle table in a many to m

Re: [SQL] matching rows differing only by fkey,pkey

2004-06-22 Thread Matthew Nuzum
Thanks for your suggestion to use curval(), that will be useful. I'd entirely forgotten about that function. That likely will help when combined with Richard's suggestion and an idea I already had. I'm sorry that the problem wasn't clearer. The best way I can describe it is like this: The end

Re: [SQL] matching rows differing only by fkey,pkey

2004-06-22 Thread Bruno Wolff III
On Tue, Jun 22, 2004 at 12:34:35 -0400, Matthew Nuzum <[EMAIL PROTECTED]> wrote: > Any ideas? If someone has an alternate method of achieving the same result > I'd be excited to hear about it. A more precise formulation of what exactly you are doing might be helpful. >From your description it so

Re: [SQL] matching rows differing only by fkey,pkey

2004-06-22 Thread Richard Huxton
Matthew Nuzum wrote: When the relationships are one to one or one to many this process is easy, however sometimes there's a many to many relationship. It seems that a helpful tool would be a query that can return just the pkey of the original record copied from and the pkey of the newly created rec

[SQL] matching rows differing only by fkey,pkey

2004-06-22 Thread Matthew Nuzum
I'm duplicating some fields in the table but the duplicates will have a new primary key and a new foreign key. For example, Table "b" looks like this: bid (pkey default value is a sequence) aid (fkey) field1 field2 field3 INSERT INTO b (aid, field1, field2, field3) SELECT 23, field1, fiel