PC Review


Reply
Thread Tools Rate Thread

Create a query to merge records with two fields as criteria

 
 
chilidog
Guest
Posts: n/a
 
      4th Mar 2010
I've got 2 tables, one with company locations/addresses and another with
contacts for the company. Table 1 has an ID field for the company name and
and ID field for the location (for that specific company). Table 2 has each
contact's name with the ID fields for company name and location. For
instance, Ajax Co has ID of 1; it's NY location has ID of 3. Joe Smith works
for Ajax in NY. How do i create the query to pull on ID field first and then
on the location field?
 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      4th Mar 2010
If I understand you correctly you would join on two fields.

SELECT *
FROM CompanyLocationsTable INNER JOIN ContactTable
ON CompanyLocationsTable .CompanyID = ContactTable.CompanyID
AND CompanyLocationsTable .LocationID = ContactTable.LocationID

In query design view
== add both tables
== Drag from companyid to companyid (set up first part of relation)
== Drag from locationID to locationID (set up second part of relation)

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

chilidog wrote:
> I've got 2 tables, one with company locations/addresses and another with
> contacts for the company. Table 1 has an ID field for the company name and
> and ID field for the location (for that specific company). Table 2 has each
> contact's name with the ID fields for company name and location. For
> instance, Ajax Co has ID of 1; it's NY location has ID of 3. Joe Smith works
> for Ajax in NY. How do i create the query to pull on ID field first and then
> on the location field?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge multiple records in a field, based on criteria? GD Microsoft Access Getting Started 2 18th Dec 2009 07:20 PM
Create Query with criteria from multiple fields Gunti Microsoft Access 4 23rd Jun 2009 05:07 PM
count of records that meet criteria from two fields =?Utf-8?B?cm9iZXJ0bTYwMDYzNQ==?= Microsoft Access Queries 1 26th Apr 2007 08:33 PM
Queries--concatenate or merge records (not fields) =?Utf-8?B?U3RldmVuIEcu?= Microsoft Access Queries 1 19th Apr 2006 03:44 PM
Merge Fields in different records =?Utf-8?B?Q2VyaQ==?= Microsoft Access Forms 5 20th Feb 2005 06:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:34 AM.