473,513 Members | 11,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sum() randomly doubles in query

I am running into a really odd problem with Access and looking for some
insight as to what could be causing my issue. Basically this SQL
creates a listing of Total Sales (Sum(InvLine.Retail)) by Category
(InvLine.Cat) which seems strait forward. But today I run the report
and a category is doubled, so I went through the basic steps of
verifying the data's intergrety wih other categories etc and nothing is
diffent about the line but instead of 4.75 its 9.50. Also even tried
changing to InvLine.Price and it doubled that as well?!?!

The problem is a single line in Table InvLine which is the only line
for this category for the report that I ran.

LId IId InvDayId IType D TS TE Unit Description Contact Quantity Retail Price TGId Total UGId Exported Cat RevAccountId
65576 10999 40088 2 3/21/2006 0 0 0 Umpqua 300
#4 1 $4.75 $4.75 3 $5.13 1 $0.00 04 Fly Tying 3

Here is my SQL

SELECT InvLine.Cat, Sum(InvLine.Retail) AS TotalCat
FROM Payments INNER JOIN ((InvLine INNER JOIN Invoice ON InvLine.IId =
Invoice.IId) INNER JOIN PaySplit ON Invoice.IId = PaySplit.IId) ON
Payments.PAYId = PaySplit.PayId
WHERE (((Invoice.Total)=[Invoice].[Paid]) AND ((Payments.PayDate)
Between #3/20/2006# And #3/22/2006#))
GROUP BY InvLine.Cat
ORDER BY InvLine.Cat;

Any Ideas?

Mar 21 '06 #1
2 4575
sb*********@gmail.com wrote:
I am running into a really odd problem with Access and looking for some
insight as to what could be causing my issue. Basically this SQL
creates a listing of Total Sales (Sum(InvLine.Retail)) by Category
(InvLine.Cat) which seems strait forward. But today I run the report
and a category is doubled, so I went through the basic steps of
verifying the data's intergrety wih other categories etc and nothing is
diffent about the line but instead of 4.75 its 9.50. Also even tried
changing to InvLine.Price and it doubled that as well?!?!

The problem is a single line in Table InvLine which is the only line
for this category for the report that I ran.

LId IId InvDayId IType D TS TE Unit Description Contact Quantity Retail Price TGId Total UGId Exported Cat RevAccountId
65576 10999 40088 2 3/21/2006 0 0 0 Umpqua 300
#4 1 $4.75 $4.75 3 $5.13 1 $0.00 04 Fly Tying 3

Here is my SQL

SELECT InvLine.Cat, Sum(InvLine.Retail) AS TotalCat
FROM Payments INNER JOIN ((InvLine INNER JOIN Invoice ON InvLine.IId =
Invoice.IId) INNER JOIN PaySplit ON Invoice.IId = PaySplit.IId) ON
Payments.PAYId = PaySplit.PayId
WHERE (((Invoice.Total)=[Invoice].[Paid]) AND ((Payments.PayDate)
Between #3/20/2006# And #3/22/2006#))
GROUP BY InvLine.Cat
ORDER BY InvLine.Cat;

Any Ideas?

Using a dumb example, let's say I have an Order and 2 customers
associated with the order. If I did a sum on the order amount
(contained in the order table) and I was linked also to the
CustomerOrder table, I woulld get a doubling value.

Any easy way to view this is to make a copy of your query. Remove the
Totals query so it becomes a simple SQL select. Now filter on the
category that it is messing up on. I think you'll find that somehow you
have 2 records of something that makes it double.
Mar 22 '06 #2
Son of a gun your right I was just thinking about this the wrong way
perfect thank you!! Just to tell you what happened, the cash
transactions have 2 lines total cash paid and change given that was it.

Mar 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1868
by: Giloosh | last post by:
Hello i have been trying to figure out this problem for a very long time now, and thought maybe its worth asking for some help. I want to figure out if there is a way to create a field in a...
3
2190
by: Joost | last post by:
I have a form based on a totals query, with one of the fields as the sum of the quantity of an article of the grouped records. I get an #error# in a control on the form where I want to display the...
1
3302
by: z.ghulam | last post by:
I've designed a query which merely counts the number of different types of orders. What I am after is a way of getting a Grand Total which will be the Sum of all the totals. It sounds simple...
0
1077
by: Stan | last post by:
I am trying to design a query that will, for a selected month, give me the sum total of a Number field "0 to 18". The criteria for the month is one that this group helped me with at an early date....
2
3853
by: glen.riddell | last post by:
I have 2 queries, for the sake of this post I will refer to them as query1 and query2. Basically query1 returns a number of results from tables which are grouped and then query2 queries query1 and...
1
1374
by: Dan2kx | last post by:
Hello, i am need to sum some data as so.. StaffID, RequestID, MinutesUsed StaffID limited by combobox on form, requestID (contains a duplicate numbers reletive to the point the record is...
1
2735
by: bbatson | last post by:
Hello, I have searched for help on this and have not been successful in finding an answer to my particular problem. I am trying to compute a running sum of sales in a query. Here is the...
6
2356
by: feed the inferno | last post by:
i think im confusing myself here but ill try my best to explain i have a form where cds can be purchased, within it is a subform which allows a user to choose from a combo box of all the cds ...
0
1395
by: Julian Mishke | last post by:
Hello, I am very new to this and having problems with the SUM and MAX in my query: SELECT Score.performerId, Performer.performerName, Performer.countrycode, Country.countryName,...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.