Building a Query from Table Fields

MiAs

Registered User.
Local time
Yesterday, 18:15
Joined
Oct 25, 2004
Messages
49
Hi,
I am trying to make a query from fields out of 3 tables.
All tables must include following fields:

Table 1 fields:
WR04 (year 2004)
Date
Reporting Person

Table 2 fields:
WR05
Date
Reporting Person

Table 3 fields:
WR06
Date
Reporting Person

I am trying to pull together in the query any given individual (Reporting Person) who may be included in all above tables but believe I may have a relationship problem as I am only getting results that match all tables.
I hope this is clear.
Any suggestions please.
 
I'm a little fuzzy about what you want. You say that you want to select people who appear in all three tables but then complain that you are getting results that match all three tables.

If you join them on reporting person with outer joins and select distinct ReportingPerson where WR04 Is Not Null and WR05 Is Not Null and WR06 is not null, you will have a list of people who appear in all three tables.
 
Sorry,to make it clearer.
I am basically getting the results I want but they are duplicated,5 fold in some cases.
I have currently got the tables linked by Reporting Person with 'joined fields from both tables equal'
Is my problem a table relationship problem
 
Try

SELECT DISTINCT Table1.ReportingPerson, Table1.Date, Table.WR04, Table2.Date, Table2.WR05, Table3.Date, Table3.WR06
FROM Table1 INNER JOIN Table2 ON Table1.ReportingPerson = Table2.ReportingPerson INNER JOIN Table3 ON Table2.ReportingPerson = Table3.ReportingPerson

I think this will give you one record for someone who shows up in all three tables.
 
Thanks for the advice GRNZBRA
I will give it a whirl
 

Users who are viewing this thread

Back
Top Bottom