• Until you get to SQL 2012, you also have the "quick-and-dirty" version of that, using COMPUTE:

    SELECT Curr_date, Action, AVG(Duration)/1000 as Avg_Duration

    FROM Table_1

    WHERE Curr_date = CAST(GETDATE() as DATE)

    GROUP BY Curr_date, Action

    -- added AVG just to show that multiple COMPUTE functions can be specified :-)

    COMPUTE SUM(AVG(Duration)/1000), AVG(AVG(Duration)/1000)

    It's sometimes easier just to slap on a COMPUTE than to rejigger the query ... and, as so often, in this case it avoids another full scan of the table (COMPUTE's a fun cheat, it died too young!).

    Note that the COMPUTEd value(s) are a separate result set, and do not have any column heading other than the function used to create them, i.e., column is named "sum" or "avg" or "count" or whatever.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.