Kaup, Chester
Chester_Kaup at kindermorgan.com
Fri Mar 23 13:41:09 CDT 2012
Seems to me like the same LastName and FirstName exist more than once in the table tblPhoneBook -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell Sent: Friday, March 23, 2012 1:34 PM To: Access Developers discussion and problem solving Subject: [AccessD] Query Help Hey guys I need help! It's been about 3 years since I have touched Access and can't recall how to build a specific query. Here is what I have: tblUsers ------------ ID - Autogenerated PK LastName FirstName ..... tblPhoneBook -------------------- ID - Autogenerated PK LastName FirstName Location What I need is a query that will give me EVERYONE from tblUsers and the matching records from tblPhoneBook. The only fields that are common are the LastName and FirstName fields. This is the SQL that I've got and it's not working correctly, or at least not to me anyway SELECT tblUsers.*, tblPhoneBook.[LastName], PhoneBook.[FirstName], PhoneBook.Location FROM tblUsers LEFT JOIN PhoneBook ON (tblUsers.FirstName = PhoneBook.[FirstName]) AND (tblUsers.LastName = PhoneBook.[LastName]) ORDER BY tblUsers.LastName; tblUsers has 987 records and the query is returning 993 records and I can't for the life of me figure it out. These tables were actually Excel Spreadsheets that were imported into Access. Help!! Please?!?! -- Bryan Carbonnell - carbonnb at gmail.com Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "What a great ride!" -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com