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.

Signature
KARL DEWEY
Build a little - Test a little
> Not sure if this should be a union, but I have two tables.
> Table A has DateOfEntry and Staff
[quoted text clipped - 12 lines]
> to piece it together.
> Any ideas...?
Jeffshex - 21 Apr 2008 21:14 GMT
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.
> >>Table A has DateOfEntry and Staff Table B has Wage
> So how are the two table connected/joined/linked?
[quoted text clipped - 22 lines]
> > to piece it together.
> > Any ideas...?
KARL DEWEY - 22 Apr 2008 00:59 GMT
Post some sample data from the tables.

Signature
KARL DEWEY
Build a little - Test a little
> Table A info:
> ==========
[quoted text clipped - 46 lines]
> > > to piece it together.
> > > Any ideas...?