Skip site navigation (1) Skip section navigation (2)

Re: matching rows differing only by fkey,pkey

From: "Matthew Nuzum" <matt(at)followers(dot)net>
To: "'Bruno Wolff III'" <bruno(at)wolff(dot)to>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: matching rows differing only by fkey,pkey
Date: 2004-06-22 17:40:03
Message-ID: 200406221740.i5MHe6nb015623@ms-smtp-02.tampabay.rr.com (view raw or flat)
Thread:
Lists: pgsql-sql
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 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 many relationship.  For example,

- a ----    - b ----    - c ----
 aid  <--+   bid  <--+   cid
 data1   +-->aid     +-->bid
 data2       field1      info1
 date3       field2      info2

SELECT a.*,b.*,c.* from a,b,c where b.aid = a.aid and c.bid = b.bid;

So, the goal is to duplicate an object that is made up of the data stored
across these three tables. 

Any suggestions?

Matthew Nuzum		| ISPs: Make $200 - $5,000 per referral by
www.followers.net		| recomending Elite CMS to your customers!
matt(at)followers(dot)net	| http://www.followers.net/isp




In response to

Responses

pgsql-sql by date

Next:From: Bruno Wolff IIIDate: 2004-06-22 18:16:49
Subject: Re: matching rows differing only by fkey,pkey
Previous:From: Bruno Wolff IIIDate: 2004-06-22 17:27:04
Subject: Re: matching rows differing only by fkey,pkey

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group