Multiple Relationships Between 2 tables in 1 Query

Table Aliases

Subject: microsoft access--multiple relationships between 2 tables in 1 query
Subject: Re: multiple relationships between 2 tables in 1 query
Date: 02/06/2001
Author: John Winterbottom <john@assaynet.com>

post reply << previous in thread  ·  next >>

In the query design grid you can add a table more than once. Access will call the second table "Project_managers1" or some such. I like to alias all my tables anyway, because the code references are easier. I would call the first Project Manager table p1 and the second one p2.  (Select Proprties in the query design grid and add an alias). Once you have the second table in the design grid, you can create a second join to the
project_manager.assistant_manager field.
 
BTW, if you adopt certain naming conventions you will have an easier life later on - especially if you decide to upgrade to another dbms like SQL Server:
 
- don't use spaces in table or field names
- use lowercase for table and field names (this is because SQL commands are written in uppercase following the ANSI standard - so your code is easier to read),
- give your tables meaningful names; "project_managers" is fine but "front_end" could make it difficult for whoever comes after you to interpret your design.
 
HTH
 
 
 
 
"Larry H" <larryh@appliedimage.com> wrote in message news:95po9a$qmb$1@nnrp1.deja.com...
> I have 2 tables, FRONT END and PROJECT MANAGERS. The FRONT END table
> has 2 fields, one called PROJECT MANAGER and another called ASSISTANT
> MANAGER. Both fields pluck their values from a "combo box" which
> extracts the info from the aformentioned PROJECT MANAGERS field. The
> table stores the "autonumber" (in both fields) from the PROJECT
> MANAGERS table corresponding to the name chosen.
>
> In a query I have, the trick is for the query to match up the number
> stored in the FRONT END table and match it up with the name in the
> PROJECT MANAGERS table which contains the same number in
> its "autonumber" field. I have no difficulty doing this with only the
> PROJECT MANAGER field by itself, but doing it simultaneously with the
> ASSISTANT MANAGER field is causing some difficulties.
>
> I am thinking the trick is to build 1 query handling one field, and
> then a 2nd query plucking those values (using the "*") from the 1st
> query and then matching up the other field. This does seem to work,
> though it doesn't allow any entries to be added to this field.
>
> Is this the only way to make this work, or are there better ways--
> particularly having 1 query handle both matchups straight from the 2
> tables?
>
> Larry R Harrison Jr
>
>
> Sent via Deja.com
> http://www.deja.com/