Solved

Multi Table MS Access Query

Posted on 2013-06-04
5
75 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
  • 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 40

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

777 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