Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My sum isn't working

Status
Not open for further replies.

jazminecat

Programmer
Jun 2, 2003
289
US
I have a query that should be making sums

SELECT DISTINCTROW ElectedOfficialsImportedData.[Emp #], ElectedOfficialsImportedData.Name, ElectedOfficialsImportedData.[Union Group], ElectedOfficialsImportedData.Range, ElectedOfficialsImportedData.Step, ElectedOfficialsImportedData.PayType, ElectedOfficialsImportedData.WeekDate, ElectedOfficialsImportedData.PPED, Sum(ElectedOfficialsImportedData.HoursWorked) AS [Sum Of HoursWorked], Sum(ElectedOfficialsImportedData.GrossPay) AS [Sum Of GrossPay], Count(*) AS [Count Of ElectedOfficialsImportedData]
FROM ElectedOfficialsImportedData
GROUP BY ElectedOfficialsImportedData.[Emp #], ElectedOfficialsImportedData.Name, ElectedOfficialsImportedData.[Union Group], ElectedOfficialsImportedData.Range, ElectedOfficialsImportedData.Step, ElectedOfficialsImportedData.PayType, ElectedOfficialsImportedData.WeekDate, ElectedOfficialsImportedData.PPED
ORDER BY ElectedOfficialsImportedData.Name, ElectedOfficialsImportedData.PPED;


It's not. I want it to total the hous and pay for each person for the PPED. So that the PPED only shows up once, even though in that pped there are 8 pays. so for pped 1/1/05, there may be 4 different types of hours but it will add those, and add the Pay.

 
So, select (and thus group) only the fields that have same value for each PPED.
eg get rid of PayType

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top