A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Customer Query



 
 
Thread Tools Display Modes
  #1  
Old November 21st, 2006, 07:50 PM posted to microsoft.public.access.queries
LiquorGuy via AccessMonster.com
external usenet poster
 
Posts: 13
Default Customer Query

Hello,

I am trying to run a query that lists all my clients, their invoice totals,
and total payments thus far. I have created two separate queries. Once
totals up the invoices and the other sums up the total payments fine.
However when I try to run them together, it only returns the one record of
the client that has a payment. How can I get it so that all clients are
displayed irregardless of whether they have paid or not. Here is my SQL
statement thus far.... THANKS!

SELECT DISTINCTROW Projects.ClientID, Projects.ProjectID, Projects.
ProjectName, Projects.ProjectDescription, [Sum of Invoice Query].[Invoice
Total], [Sum of Payments Query].[Total Payments]
FROM ((Clients INNER JOIN ([Sum of Payments Query] RIGHT JOIN Projects ON
[Sum of Payments Query].ProjectID = Projects.ProjectID) ON Clients.ClientID =
Projects.ClientID) INNER JOIN Payments ON Projects.ProjectID = Payments.
ProjectID) INNER JOIN [Sum of Invoice Query] ON Clients.ClientID = [Sum of
Invoice Query].ClientID
GROUP BY Projects.ClientID, Projects.ProjectID, Projects.ProjectName,
Projects.ProjectDescription, [Sum of Invoice Query].[Invoice Total], [Sum of
Payments Query].[Total Payments];

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200611/1

  #2  
Old November 21st, 2006, 08:13 PM posted to microsoft.public.access.queries
QC Coug
external usenet poster
 
Posts: 5
Default Customer Query

It sounds like you have two queries. I think you need to link the two
queries and use a left (or right) join. Right click on the relationship
(line) between the two queries and it will show a window that will ask you
how you want the link to be. You will want it to include all records from
the table that has all of the invoicing. I assume there won't be any
payments for customers unless there is an invoice.

"LiquorGuy via AccessMonster.com" wrote:

Hello,

I am trying to run a query that lists all my clients, their invoice totals,
and total payments thus far. I have created two separate queries. Once
totals up the invoices and the other sums up the total payments fine.
However when I try to run them together, it only returns the one record of
the client that has a payment. How can I get it so that all clients are
displayed irregardless of whether they have paid or not. Here is my SQL
statement thus far.... THANKS!

SELECT DISTINCTROW Projects.ClientID, Projects.ProjectID, Projects.
ProjectName, Projects.ProjectDescription, [Sum of Invoice Query].[Invoice
Total], [Sum of Payments Query].[Total Payments]
FROM ((Clients INNER JOIN ([Sum of Payments Query] RIGHT JOIN Projects ON
[Sum of Payments Query].ProjectID = Projects.ProjectID) ON Clients.ClientID =
Projects.ClientID) INNER JOIN Payments ON Projects.ProjectID = Payments.
ProjectID) INNER JOIN [Sum of Invoice Query] ON Clients.ClientID = [Sum of
Invoice Query].ClientID
GROUP BY Projects.ClientID, Projects.ProjectID, Projects.ProjectName,
Projects.ProjectDescription, [Sum of Invoice Query].[Invoice Total], [Sum of
Payments Query].[Total Payments];

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200611/1


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.