MS Access 2013 Query Grouping

Hi all,

I've a (probably) silly question re Access 2013 queries. I've not done Access in years and even then only at a very low level.

I've got a query that returns a Date, a Client, A Unit and a Price. Some units have many clients in; some clients are in more than one unit.

eg.

13/4/15      Client1       Unit01     £3000
13/4/15      Client 2      Unit01     £2500
13/4/15      Client1       Unit02     £1800
13/4/15      Client2       Unit02     £600
 
I'm trying to display the query with just the total price per unit against each as below

13/4/15     Unit01       £5500
13/4/15     Unit02       £2400

What do I need to do to the query to make it show in this format? Or do I need another intermediate query to get that information out?

Thanks

Bob
LVL 2
Bob SampsonHead Of ITAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard DanekeTrainerCommented:
Looks like a job for a crosstab query.  In SQL it is a transform statement.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob SampsonHead Of ITAuthor Commented:
I've looked at crosstabs, and whilst they appear to work, I am not sure they will give me what I need as I want to take the results of the query and run some further maths against them (basically, if I can get a measure of income against unit, I can populate further fields with the cost of the unit and get the margin against each. Is there a way you know of?
0
Richard DanekeTrainerCommented:
You need a group by clause.  Sample:

SELECT Clients.DtActivity, Clients.Unit, Sum(Clients.CurPrice) AS SumOfCurPrice
FROM Clients
GROUP BY Clients.DtActivity, Clients.Unit;
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
As Richard said, a "GROUP BY" (or totals query - the "E" button in the query designer).   Group By on the date and sum the price and simply ignore the customer.

Jim.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.