indirectly related tables

G

Guest

Im trying to get a form to show fields from other tables that are not
directly related but I cant figure it out. Ive got:

Company Table > related to
Operating District Table > related to
Lease Table > related to
Well Table

My form is supposed to show fields from the Well table but I also want it to
show the Company, District, and Lease the well is assigned to.

I have no problem with the Lease relationship, its when I try to get the
related company and operating district that messes everything up.

Any suggestions?

Thanks
 
G

Guest

In your query with these tables do a left join in the same order you laid out
in your post.
SELECT [Company Table].CompanyID, [Operating District
Table].Operating_DistrictID, [Lease Table].LeaseID, [Well Table].WellID
FROM (([Company Table] LEFT JOIN [Operating District Table] ON [Company
Table].CompanyID = [Operating District Table].CompanyID) LEFT JOIN [Lease
Table] ON [Operating District Table].Operating_DistrictID = [Lease
Table].Operating_DistrictID) LEFT JOIN [Well Table] ON [Lease Table].LeaseID
= [Well Table].LeaseID;
 
G

Guest

That worked! Thanks!
--
JLV


KARL DEWEY said:
In your query with these tables do a left join in the same order you laid out
in your post.
SELECT [Company Table].CompanyID, [Operating District
Table].Operating_DistrictID, [Lease Table].LeaseID, [Well Table].WellID
FROM (([Company Table] LEFT JOIN [Operating District Table] ON [Company
Table].CompanyID = [Operating District Table].CompanyID) LEFT JOIN [Lease
Table] ON [Operating District Table].Operating_DistrictID = [Lease
Table].Operating_DistrictID) LEFT JOIN [Well Table] ON [Lease Table].LeaseID
= [Well Table].LeaseID;

--
KARL DEWEY
Build a little - Test a little


Jose said:
Im trying to get a form to show fields from other tables that are not
directly related but I cant figure it out. Ive got:

Company Table > related to
Operating District Table > related to
Lease Table > related to
Well Table

My form is supposed to show fields from the Well table but I also want it to
show the Company, District, and Lease the well is assigned to.

I have no problem with the Lease relationship, its when I try to get the
related company and operating district that messes everything up.

Any suggestions?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top