Solved

Help with MS Access query

Posted on 2013-06-20
4
133 Views
Last Modified: 2013-11-19
I need a query that delineates new records that have been added for each month.  The records have a unique ID.  The update month is also a field. Please see the example data database and the desired results (excel)

Any Takers!
TestMDB.accdb
Example.xlsx
0
Comment
Question by:Thomask23
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:Bitsqueezer
ID: 39264262
Hi,

maybe this query is what you want:

TRANSFORM Count([Sample Table].[ID]) AS AnzahlvonID
SELECT 'Count Of Dates' AS [Count of Dates], Count([Sample Table].[ID]) AS [Count of all]
FROM [Sample Table]
GROUP BY 'Count Of Dates'
PIVOT Format([Update Date],"Short Date");

Open in new window


You can of course also group that by "Data":

TRANSFORM Count([Sample Table].ID) AS AnzahlvonID
SELECT [Sample Table].Data, Count([Sample Table].ID) AS [Count of all]
FROM [Sample Table]
GROUP BY [Sample Table].Data
PIVOT Format([Update Date],"Short Date");

Open in new window


Cheers,

Christian
0
 

Author Comment

by:Thomask23
ID: 39265740
Almost...

The records are identified as new by the ID. If a new id is updated to the data it should only be count it. I want to count the only the new records added by the updated date.
0
 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 500 total points
ID: 39267402
Hi,

that was not clear from your example and to be exact, it is not clear from what you wrote now.

You can create a query like this to get the newest ID of each date if that is what you want:

SELECT [Sample Table].[Update Date], Max([Sample Table].ID) AS MaxvonID
FROM [Sample Table]
GROUP BY [Sample Table].[Update Date];

Open in new window


You see that any date value always only have one ID and so the result of a count in a further query would always be 1.

(That can also be transformed like in the example above but normally it's better to create normal queries than crosstab queries as these have a limitation of 255 columns.)

If that's not what you thought of then please be more exact.

A "new ID" cannot be "updated", only inserted.

Cheers,

Christian
0
 

Author Comment

by:Thomask23
ID: 39659432
Thanks
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
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.
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.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

792 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