• How to add running total column to a query

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » How to add running total column to a query

    Author
    Topic
    #501969

    I have the following query:

    SELECT Count(tblEmployee.id) AS [Count], tbllocal.ID AS LID, tbllocal.local_cd AS LCD, tbllocal.local_name AS LDE
    FROM tblEmployee LEFT JOIN tbllocal ON tblEmployee.local_id = tbllocal.ID
    GROUP BY tbllocal.ID, tbllocal.local_cd, tbllocal.local_name
    ORDER BY tbllocal.local_name;

    It displays the following:

    Code:
    Count   LID LCD LDE
    2719 
    1       16  105    Local 158
    1216    1   17  Local 17
    528     5   17  Local 17
    1       2   463 Local 463
    1       13  841 Local 841
    

    How do I add a 5th column Run Count that shows running total of the Count column?

    Run Count
    2719
    2720
    3936
    4464
    4465
    4466

    Viewing 0 reply threads
    Author
    Replies
    • #1526528

      What is tbllocal.ID and tbllocal.local_cd.

      Where does the line showing only 2719 come from?

      One way would be to populate a table with the above, then calculate that column into a new field, then query that table.

    Viewing 0 reply threads
    Reply To: How to add running total column to a query

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: