Getting an average from subquery values or another aggregate function in SQL Server

I can’t see your whole query as it doesn’t seem to have posted correctly.

However, I believe your problem is purely a lack of a name for your derived table / nested subquery.

Give it an alias, such as MyTable in this example

SELECT
    AVG(pageCount)
FROM
(
    SELECT 
        COUNT(ActionName) AS pageCount
    FROM
        tbl_22_Benchmark
) MyTable

Leave a Comment