Solved

Summarize by Date in Access Query

Posted on 2012-08-21
5
316 Views
Last Modified: 2012-08-21
Hi all,

I am doing a query (please see picture for where I stand)

What I really want to do is summarize origin & destination columns data by each date

There are 12 unique origin and destin for each date

eg:

Trip Date              ORIGIN        DESTIN                            

2/07/2012            TO                 VA
2/07/2012            TO                 CA
2/07/2012            TO                 ED
2/07/2012            TO                 WI
2/07/2012            TO                 OTHER
2/07/2012            ML                 VA
2/07/2012            ML                 CA
2/07/2012            ML                 ED
2/07/2012            ML                 WI
2/07/2012            ML                 OTHER
2/07/2012            REST              REST

How do I go on to summarize the data by date from this point on?

Any help in correct step is much appreciated!
Temp.PNG
0
Comment
Question by:Shanan212
  • 2
  • 2
5 Comments
 
LVL 39

Expert Comment

by:als315
Comment Utility
Can you show expected result?
0
 
LVL 22

Expert Comment

by:Flyster
Comment Utility
If you're looking for a count of each unique value, you can use this:

SELECT YourTable.[Trip Date], YourTable.[ORIGIN], YourTable.[DESTIN], Count(YourTable.ORIGIN) AS CountOfORIGIN
FROM YourTable
GROUP BY YourTable.[Trip Date], YourTable.[ORIGIN], YourTable.[DESTIN];

Flyster
0
 
LVL 13

Author Comment

by:Shanan212
Comment Utility
The expected result is this

2/07/2012            TO                 VA
2/07/2012            TO                 CA
2/07/2012            TO                 ED
2/07/2012            TO                 WI
2/07/2012            TO                 OTHER
2/07/2012            ML                 VA
2/07/2012            ML                 CA
2/07/2012            ML                 ED
2/07/2012            ML                 WI
2/07/2012            ML                 OTHER
2/07/2012            REST              REST

My current results are in the screenshot

Flyster, its not nessarily unique value as for each date, there is are multilple "TO" as origin and "VA" available (example)
0
 
LVL 22

Accepted Solution

by:
Flyster earned 500 total points
Comment Utility
The code I provided will give you that result with the addition of a count field which tells you how many such entries exists. If you don't need the count, you can use this:

SELECT YourTable.[Trip Date], YourTable.ORIGIN, YourTable.DESTIN
FROM YourTable
GROUP BY YourTable.[Trip Date], YourTable.ORIGIN, YourTable.DESTIN;
0
 
LVL 13

Author Closing Comment

by:Shanan212
Comment Utility
That works! Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now