Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query dropping records 1

Status
Not open for further replies.

cc143most

Technical User
Jun 1, 2009
12
US
I have created the following in Access 2007 where I want ALL records from Hospital Addresses listed, whether or not there is a corresponding record in Hospital Contacts. All dropped records have no Hospital Contact record; but, I believe that is what my relationship type covers. Can anyone help? BTW, I did this using Access menus before I understood anything about SQL. Thank you!

Code:
SELECT [Hospital Addresses].[KeyFind #], [Hospital Addresses].Status, 
[Hospital Addresses].Type, [Hospital Addresses].[Last Updated], [Hospital 
Addresses].[Hospital Name], [Hospital Addresses].Address, [Hospital 
Addresses].Zip, [Hospital Addresses].[Mail Address], [Hospital 
Addresses].[Mail Zip], [Hospital Addresses].City, [Hospital 
Addresses].County, [Hospital Addresses].State, [Hospital Addresses].[Main 
Phone #], [Hospital Addresses].[Fax No], [Hospital Addresses].Website, 
[Hospital Addresses].Classification, [Hospital Addresses].[Designated 
Requestor Facility?], [Hospital Addresses].[Lions Dist], [Hospital 
Addresses].OPO, [Hospital Addresses].[OPO Code], [Hospital 
Addresses].Comments, [Hospital Contacts].[Contact Type], [Hospital 
Contacts].Sal, [Hospital Contacts].FName, [Hospital Contacts].LName, 
[Hospital Contacts].Title, [Hospital Contacts].[Contact Phone], [Hospital 
Contacts].Ext, [Hospital Contacts].[Contact Email], [Hospital 
Contacts].Comments, [HLEB Coordinator Contact Info].[Coordinator Name]
FROM ([HLEB Coordinator Contact Info] RIGHT JOIN [Hospital Addresses] ON 
[HLEB Coordinator Contact Info].Branch=[Hospital Addresses].Branch) INNER 
JOIN [Hospital Contacts] ON [Hospital Addresses].[KeyFind #]=[Hospital 
Contacts].[Keyfind #]
ORDER BY [Hospital Addresses].[Hospital Name];
 
What about this FROM clause ?
FROM ([Hospital Addresses]
LEFT JOIN [HLEB Coordinator Contact Info] ON [Hospital Addresses].Branch=[HLEB Coordinator Contact Info].Branch)
LEFT JOIN [Hospital Contacts] ON [Hospital Addresses].[KeyFind #]=[Hospital Contacts].[Keyfind #]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you! I'm still trying to get a handle on the different join types and thought I had this one, lol. I GREATLY appreciate the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top