;with cte as (SELECT q.GroupId, (SumOfcert_complete/CountOfcert_complete)*100 AS Percent_Certified, Groups.GroupName FROM qryGroupCert_base AS q INNER JOIN Groups ON q.GroupId=Groups.GroupId) select * from cte UNION ALL select 0 as GroupID, SUM(Percent_Certified), 'ALL' as GroupName from cte>I have this query:
>SELECT q.GroupId, > (SumOfcert_complete/CountOfcert_complete)*100 AS Percent_Certified, > Groups.GroupName > FROM qryGroupCert_base AS q > INNER JOIN Groups ON q.GroupId=Groups.GroupId >>
>GroupId percent_certified GroupName >286 58 Group A >287 58 Group B >288 100 Group C >289 100 Group D >>
>GroupId percent_certified GroupName >286 58 Group A >287 58 Group B >288 100 Group C >289 100 Group D >0 315 All >>
>SELECT q.GroupId, > (SumOfcert_complete/CountOfcert_complete)*100 AS percent_certified, > (Sum(SumOfcert_complete/CountOfcert_complete)*100)) / 4 AS Total, > Groups.GroupName >FROM qryGroupCert_base AS q INNER JOIN Groups ON q.GroupId=Groups.GroupId; >>