counting by month

etk

Registered User.
Local time
Today, 04:25
Joined
May 21, 2011
Messages
52
I have a table that I want to count the employees by the number of times they call in a month.

The table has the following fields that are relevant:

CLL_ID
CallerEmpID
DT

I have made this query which returns my answers, but I would like to make each "month_year" a column field and return a table with the CallerEmpID as the primary key of a tally of calls by month. Currently I can only do this using a pivot table, which is one more step than I would like to take. Any suggestions?


PHP:
SELECT FCData_adjusted.CallerEmpID, COUNT(FCData_adjusted.CallerEmpID) AS countof_empID, Month([DT]) & "_" & Year([DT]) AS Mth_Yr 
INTO tbl_NHD_tally
FROM FCData_adjusted
GROUP BY CallerEmpID, Month([DT]), Year([DT]);
 
but I would like to make each "month_year" a column field and return a table with the CallerEmpID as the primary key of a tally of calls by month

Your use of jargon got in the way of your expression of ideas. I recognize all those words, but together I have no idea what you are attempting to communicate with them.

Could you post some sample data from your table (including the table and fields' names) as well as what you ultimately want to end up with based on that sample data?
 
Currently the query (posted above) executes like this:

CallerEmpID_Count___Mth_Yr
9094________21____05_2013
9094________25____06_2013


and I would like it to look like this:

CallerEmpID__05_2013__06_2013
9094__________21_______25


and I want to do it without the extra step of creating a pivot view/table. I also will be doing this ongoing, deleting the last month of a six-month period and updating with the most recent month. I get the sense that I will need to declare the fields programmatically to accomplish this?
 
Last edited:
The simplest method is a pivot query based on the query you say generates the first set of data.
 

Users who are viewing this thread

Back
Top Bottom