SQLTeam.com | Weblogs | Forums

Avg at the end of returned rows

Hi I have the following statement:

SELECT Centre, ROUND(AVG(CAST(recruitment AS FLOAT)), 2) as Rating FROM Table where Recruitment is not null and try_convert(DATE, [Enddate], 103) >= @startdate and try_convert(DATE, [Enddate], 103) <= @enddate group by centre order by Centre

It returns the following

Center Rating
Center1 7.7
Center2 8.5
Center3 8.8

I want to add the avg below center 3 as follows

Center Rating
Center1 7.7
Center2 8.5
Center3 8.8
Avg 8.33

Thanks in advance

one idea

select statement
union all
select avg statement

Lookup GROUPING SETS and CUBE/ROLLUP.

Is this for reporting purposes?