Avatar of Pau Lo
Pau Lo

asked on 

statistical query over multiple tables

I need to perform some analysis in an Access database based on payroll data. I have the payroll data for 12 months worth of payments, each imported into the database in a table, so a table for payroll data would show, amongst other fields, amount paid in January 2021, February 2021, March 2021, April 2021, May 2021, June 2021 etc etc.... per employee.

I need to look for unique differences across a number of key fields across the various tables (monthly data). There are a few key columns, the unique identifier for each individual, and therefore each record in a table, is a field called Employee ID. Firstly I needed a query to summarize across all months data (represented in a table per month), the amount of unique payment amounts for each Employee ID. The payment column is netPay.

Query results would ideally be returned in a 'grouped and unique count' format across the tables, e.g. Employee ID, netPay unique value, unique count. So if employee ID had 11 months netPay at 2000, and 1 month pay at 2100, the results would group on employee ID, and show for employee ID XYZ, unique value 2000, a count of 11 (11 instances where the value in the netPay column was the same in 11 tables for the employee ID), and unique value 2100 a count of 1 (where the netPay value was unique/different in 1 of the tables for the employee ID).

Any ideas on the best way to approach this in Access, via a query or any reporting tools within the software? Can it be done in a single query, or would it require a few stages? Once I have an idea on how best to do it for one of the fields I need stats/unique value counts for, in this case the netPay column, I can run it over additional fields tied to employee ID to look for differences across the tables.
DatabasesMicrosoft Access

Avatar of undefined
Last Comment
Pau Lo
Avatar of _agx_
_agx_
Flag of United States of America image

Can it be done in a single query

Possibly.

Could you give a small (anonymized) sample of the data - and the desired results?
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Did I understand you correctly, that you have a separate table for each month?
Avatar of Pau Lo
Pau Lo

ASKER

yes that's correct
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Pau Lo
Pau Lo

ASKER

Thanks for the pointers, it is not a live application database, but just what we have decided on to run the analysis. The data was received in 12 individual spreadsheets representing a month, and imported into a single access database.
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Any time you try to do analysis like this, it is better to have all of the data in a single table, with fields that identify the year and month.  You probably already have a date field in the data that you could use rather than adding those two fields in the Union query.

HTH
Dale
Avatar of Pau Lo
Pau Lo

ASKER

Yes that's good advice, in this case I will have to put the key fields together using a union query and then analyze that with cross-tab
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo