Solved

Multi Table MS Access Query

Posted on 2013-06-04
5
94 Views
Last Modified: 2016-04-01
I have a MS Access database with three (3) tables:

- tbl_Master (primary key on "customer_id).  
1:Many relationship on "account_number" in the "tbl_Relationship table.

- tbl_Accounts (primary key on "account_number")
1:Many relationship on "customer_id" in the "tbl_Relationship table.

- tbl_Relationship (primary key on "customer_id" and "account_number")

I am trying to design a query (or two (2) queries that will show me the following:

QUERY 1
CUSTOMER_ID | TOTAL # of Accounts

I would like this query to show me the total number of accounts associated with each unique customer ID and just show the total.

QUERY 2
CUSTOMER_ID | ACCOUNT_NUMBER | UPDATE_BY | DATE

I would like the query to show me me the account numbers that are associated with each unique customer ID, along with who updated the account and when.

Can anyone help?
0
Comment
Question by:davidkohne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
MrC63 earned 250 total points
ID: 39220512
For the first query, use:

Select tbl_Master.Customer_ID, Count (tbl_Accounts.Customer_ID) as Total
From tbl_Master
Inner Join tbl_Accounts on tblMaster.Customer_ID=tbl_Accounts.Customer_ID
Group By Customer_ID
0
 
LVL 4

Expert Comment

by:MrC63
ID: 39220517
For query #2, use:

Select Distinct Customer_ID, Account_Number,Update_By,Date
From tbl_Master
Inner Join tbl_Accounts on tblMaster.Customer_ID=tbl_Accounts.Customer_ID
0
 
LVL 41

Assisted Solution

by:Sharath
Sharath earned 250 total points
ID: 39220520
Query 1:

SELECT customer_id,count(*) Total_Accounts
  FROM tbl_Relationship
GROUP BY customer_id

Query 2:

select tbl_Accounts.customer_id,tbl_Relationship.account_number,updated_by,updated_date
  from tbl_Relationship
  inner join tbl_Accounts on tbl_Relationship.customer_id = tbl_Accounts.customer_id
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question