I have a very simple table with EventCountTime (datetime) and EventCount (smallint).
I would like a query to simply give me the AVG EventCount for the most recent 10 (last in table) entries in the table.
I have tried
select AVG(EventCount) from ( select top 10 EventCount from EventRecord order by EventCountTime desc )
but I get
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ')'.