[AccessD] Query Help

jwcolby jwcolby at colbyconsulting.com
Fri Mar 23 14:07:29 CDT 2012


It does sound that way.

John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it

On 3/23/2012 2:41 PM, Kaup, Chester wrote:
> 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?!?!
>



More information about the AccessD mailing list