thank you for your answer,this is the relation
first I inserted average and application_id and then update statement.this is the archive table:
insert query:select application_id, test_name,status,count(*) as numberinto #temptbfrom tbl_app_monitoringgroup by application_id, test_name, statusselect application_id , test_name,sum(number) as totalinto #temptb2from #temptbgroup by application_id, test_nameinsert into tbl_app_monitoring_archive (test_name,percentage_status,application_id)select TT1.test_name, cast(((number*1.0) /(total*1.0))*100 as int),TT1.application_id from #temptb TT1 inner join #temptb2 TT2on TT1.application_id = TT2.application_idwhere status = 'alive'group by TT1.test_name, number , total,TT1.application_id
this is the query that i want to update:select cast(avg(cast(reply as decimal(12,2))) as decimal(12,2)) from tbl_app_monitoringgroup by test_name, application_id
result: