Grouping and adding columns

  • Thread starter Thread starter Jeffshex
  • Start date Start date
J

Jeffshex

Not sure if this should be a union, but I have two tables.
Table A has DateOfEntry and Staff
Table B has Wage
I'm trying to get a grouped query where it will do grouping by staff but yet
count the staff and average the wage both for a specified month and YTD. For
example:

Staff MonthlyPlacements MonthlyAvgWage YTDPlacements YTDWage
================================================
John 5 $7.00 10
$8.34
etc...

i don't mind hard coding the date ranges in the query, but I'm not sure how
to piece it together.
Any ideas...?
 
Table A has DateOfEntry and Staff Table B has Wage
So how are the two table connected/joined/linked?
Where does the data for Placements come from?
Is the 'MonthlyAvgWage' that for all Staff or just John?

Post your complete table structure with field names and datatype.

Post some sample data from the tables not just what you want the output to
look like.
 
Table A info:
==========
PK - JCID (autonum)
FK - PlacementID (number)
Staff (text)
DateOfEntry (DateTime)

Table B info
===========
PK - PlacementID (Autonumber)
Wage (Currency)
(there are other fields here which are irrelevent to this post)

b.PlacementID <=> a.PlacementID

These are the only fields I'm using. I'm trying to group by ALL staff for
the month I specify in the query, I am also trying to put together info for
year to date on that same data. So I thought I could group by staff and do 2
queries and alias the Count and Avg functions to break down placement data by
month and year for each person. So that example in my previous post would be
persay all of March's monthly data and YTD data for just John.

----Hopefully that clears up the structure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top