Jump to content
Server Maintenance This Week. ×

Examples of a Self-Join


appdemon

This topic is 8634 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Just learning this db and having a lot of fun with the relationships. I have created examples of one to one relationships and understand the portals to display the one to many. I still have yet to discover a good example of why I would want to use a self-join. Would it not be quicker to create 2 files and define a one to one or does it utilize less cpu to perform a self-join?

I guess I have hit a wall because I don't understand how you define a relationship between different match fields. I am still thinking the fields must be equal. The help file did not make it clearer to me. Help anyone?

Link to comment
Share on other sites

quote:

Originally posted by appdemon:

Just learning this db and having a lot of fun with the relationships. I have created examples of one to one relationships and understand the portals to display the one to many. I still have yet to discover a good example of why I would want to use a self-join. Would it not be quicker to create 2 files and define a one to one or does it utilize less cpu to perform a self-join?

I guess I have hit a wall because I don't understand how you define a relationship between different match fields. I am still thinking the fields must be equal. The help file did not make it clearer to me. Help anyone?

A self-join is not typically part of a relational database structure. A self-join is a convienent way to perform finds and summarizations.

For instance, let's say that you are looking at customer records and want a count of all customers in the same zip code to be shown on the screen.

Easist way is to do a self-join by Zip Code and setup a calculation Count (Self by ZipCode::CustomerID).

Some procedures may want to work ONLY on the current record. Well you may want to insure that you are only working on ONE record, so you do a Go To Related Record [self by CustomerID, Show Only Related Records].

And I could go on and on.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Senior Filemaker Developer

http://www.database-resources.com

mailto:[email protected]

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

quote:

Originally posted by appdemon:

Just learning this db and having a lot of fun with the relationships. I have created examples of one to one relationships and understand the portals to display the one to many. I still have yet to discover a good example of why I would want to use a self-join. Would it not be quicker to create 2 files and define a one to one or does it utilize less cpu to perform a self-join?

I guess I have hit a wall because I don't understand how you define a relationship between different match fields. I am still thinking the fields must be equal. The help file did not make it clearer to me. Help anyone?

For a good discussion on the uses of self-joins and the many ways you can use them, check out Scriptology by Matt Petrowsky and John Mark Osborne. It's available at store.filemakerworld.com. I think it's the most valuable book on FileMaker available.

Chuck

Link to comment
Share on other sites

This topic is 8634 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.