Paul Hartland
paul.hartland at googlemail.com
Sat Mar 24 01:42:36 CDT 2012
Bryon, Sounds a dodgy way of doing it really as all you need is duplicates and suspect that you have duplicate firstname & lastname in either tblUsers or tblPhonebook which is creating the additional records. What should be happening is an additional field in tblPhonebook called something like UserID and place the ID of tblUsers in that field then link on that. Paul On 23 March 2012 18:34, Bryan Carbonnell <carbonnb at gmail.com> wrote: > 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 > -- Paul Hartland paul.hartland at googlemail.com