Month Total and Year Total per item

  • I need a over all total amount for every field per month and I dont know how to incorporate that into my select statment. this on month 12 = December and I need to know what the total is for each individual field. Example what CameraRepair had 12 but for the year it should be 200

    Camera Repair CableRepair

    Month YTD Month YTD

    10 120

    12 200

    SELECT SUM(CameraRepair) AS MCameraRepair, SUM(CableRepair) AS MCableRepair, SUM(CameraMaintenance_Cleaning) AS MCamerMaintenance,

    SUM(DVRMaintenance_Cleaning) AS MDVRMaintenance, SUM(Moves_Installs) AS MMoves_Installs, SUM(TechAreaCleaning) AS MTechAreaCleaning,

    SUM(Other) AS MOther, Month

    FROM Technicians

    GROUP BY Month

    HAVING (Month = 12)

  • hi,

    Using rollup may help. Just add with rollup after your GROUP BY

    http://msdn.microsoft.com/en-us/library/ms189305(SQL.90).aspx

    Bevan

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply