locked
How to implement a SQL Select stament to sum up all items in my case? RRS feed

  • Question

  • User-609535877 posted

    I got one sql server table that one employeeID comes with multiple rows of  data (see following sample for two employees)

    EmployeeID Part                    PayDate         DeductionType           DeductionAmount
    0014313 1   PAYROLL DETAIL  2018-05-04   CITY TAX                   70.16
    0014313 1   PAYROLL DETAIL  2018-05-04   CREDIT UNI               178.69
    0014313 1   PAYROLL DETAIL  2018-05-04   FEDERAL TA               187.08
    0014313 1   PAYROLL DETAIL  2018-05-04   FICA                          105.56
    0014313 1   PAYROLL DETAIL  2018-05-04   HEALTH                      454.75
    0014313 1   PAYROLL DETAIL  2018-05-04   LIFE INSUR                 96.74
    0014313 1   PAYROLL DETAIL  2018-05-04   MEDICARE                  24.69
    0014313 1   PAYROLL DETAIL  2018-05-04   MUNICIPAL                 3.00
    0014313 1   PAYROLL DETAIL  2018-05-04   STATE TAX                 104.08
    0014313 1   PAYROLL DETAIL  2018-05-04   UNION DEDU              45.49
    0027524 1   PAYROLL DETAIL  2018-05-04   CH 96 PEN                   41.08
    0027524 1   PAYROLL DETAIL  2018-05-04   CITY TAX                     71.88
    0027524 1   PAYROLL DETAIL  2018-05-04   FEDERAL TA                262.67
    0027524 1   PAYROLL DETAIL  2018-05-04   FICA                           133.54
    0027524 1   PAYROLL DETAIL  2018-05-04   HEALTH                       6.39

    How do I write a SQl Select statement to sum up all of items such as SUM([City Tax]), SUM([CREDIT UNI]), SUM(FICA) .....for all employee in a given Paydate? Thanks a lot!

    Thursday, May 17, 2018 3:07 PM

Answers

All replies