Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

Grouping and adding columns

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeffshex - 21 Apr 2008 19:34 GMT
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...?
KARL DEWEY - 21 Apr 2008 21:01 GMT
>>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...?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.