Solved

Trying to Sum in access query with criteria without grouping by critieria.

Posted on 2012-03-12
5
263 Views
Last Modified: 2012-03-12
I have lines of amounts that I differentiate with Sequence numbers (Seq is the field name). I want to Sum Seq 1 through 4 without having the query display them as individual lines.

Here is a screenshot of the query;
query
and here is the sql;
SELECT Sum(qryCSLPL.SumOfAmount) AS Amount, 5 AS Seq
FROM qryCSLPL
GROUP BY 5, qryCSLPL.Seq
HAVING (((qryCSLPL.Seq)>=1 And (qryCSLPL.Seq)<=4));


My results for this give me each seq 1 through 4 on seperate lines. Where I want to see just one line with a total for all four of them.

Any ideas?
0
Comment
Question by:SeyerIT
[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
5 Comments
 
LVL 57
ID: 37711306
Not sure I understand the problem; just leave the sum column and nothing else.

Jim.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37711312
Try removing the grouping on that field and use a wher clause for criteria instead of having.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37711339
change Group by with Expression in the Seq field
0
 
LVL 2

Author Comment

by:SeyerIT
ID: 37711358
Capricorn, I tried Expression.. That gave me an error.

There 'Where' clause that mbizup mentioned did the trick.

Thanks a bunch!
0
 
LVL 2

Author Comment

by:SeyerIT
ID: 37711370
Sorry Jim.. Somehow I didn't even see your comment at the top. Here is what I was trying to end up with in my result for the query;

Seq                        LineItem                                          Amount
5                          "Total Gross Sales"                            $341,324.00


It needed to sum Seq 1-4, give me that total amount and then the new Seq would be 5 and I would designate the LineItem name as "Total Gross Sales".
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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…
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.

733 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