dbTalk Databases Forums  

Self-join

comp.databases.filemaker comp.databases.filemaker


Discuss Self-join in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
George
 
Posts: n/a

Default Self-join - 04-27-2005 , 04:05 PM






I am stumped how to use a self join to extract a correct information
from the same table. I assume that a self join is the way to do what I
want to accomplish.

I have a table called Firms in which I store information about
accounting firms (such as address, telephone, URL, specialties etc). A
short name of the firm, which is created manually, and is the primary
key. It must be unique. A long name field contains a full legal name of
the firm.

Many small accounting firms have an alliance relationship with larger
accounting firms. So as a part of the Firm table fields I also have a
short name for the alliance firm, if any. I insert the short name using
an index. I would like to extract the long name of the alliance firm
from the same table, corresponding with the short name. But I am
walking in circle and got all wrapped up in table occurences and
correct relationships. Can' find my way out.

Can anybody help? I am sure this must be trivial to many, but it is a
new thing and a challenge to me.

Thanks

George


Reply With Quote
  #2  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Self-join - 04-28-2005 , 02:44 AM






In article <1114635920.948412.42550 (AT) l41g2000cwc (DOT) googlegroups.com>,
"George" <g.sova (AT) comcast (DOT) net> wrote:

Quote:
I am stumped how to use a self join to extract a correct information
from the same table. I assume that a self join is the way to do what I
want to accomplish.

I have a table called Firms in which I store information about
accounting firms (such as address, telephone, URL, specialties etc). A
short name of the firm, which is created manually, and is the primary
key. It must be unique. A long name field contains a full legal name of
the firm.

Many small accounting firms have an alliance relationship with larger
accounting firms. So as a part of the Firm table fields I also have a
short name for the alliance firm, if any. I insert the short name using
an index. I would like to extract the long name of the alliance firm
from the same table, corresponding with the short name. But I am
walking in circle and got all wrapped up in table occurences and
correct relationships. Can' find my way out.

Can anybody help? I am sure this must be trivial to many, but it is a
new thing and a challenge to me.

Thanks

George
If I'm reading this right, then you need two fields:

ShortName Text
used to store the short name of THIS firm (ie. the firm
the record data on-screnn is for)

Alliance_ShortName Text
used to store the Alliance Firm's short name

Then all you need is a self-join relationship set-up as:

SelfJoin Alliance_ShortName --> Firms::ShortName

and you can then pick up the Alliance Firm's fields via this
relationship.

BUT, this will only work if "ShortName" contains unique data for each
firm. You'll also have a problem if there's more than one Alliance
Firm, but I won't worry about that unless you've actually got that
problem.

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.