Comment mettre à jour cette requête sans bouclage ou slider dans SQL Server 2005

update a_program set total_paguindikatif_rkpd = (select sum(isnull(pagu_dana_rkpd, 0)) from a_kegiatan where id_prog = @id_prog and is_deleted = 0 and id_jenisanggaran = 2 and status in(1,3,7,9) ), total_paguindikatif_kuappas = (select sum(isnull(pagu_dana_kuappas, 0)) from a_kegiatan where id_prog = @id_prog and is_deleted = 0 and id_jenisanggaran = 2 and status in(1,2,3,4,7,8,9,10) ) where id_prog = @id_prog and id_jenisanggaran = 2; 

C'est ma question. Je veux mettre à jour automatiquement sans loop @id_prog à cette requête. Comment puis-je faire ceci?

Merci de m'avoir aidé.. 🙂

 update a set total_paguindikatif_rkpd = (select sum(isnull(pagu_dana_rkpd, 0)) from a_kegiatan where id_prog = a.id_prog ---<<< and is_deleted = 0 and id_jenisanggaran = 2 and status in(1,3,7,9) ), total_paguindikatif_kuappas = (select sum(isnull(pagu_dana_kuappas, 0)) from a_kegiatan where id_prog = a.id_prog ---<<< and is_deleted = 0 and id_jenisanggaran = 2 and status in(1,2,3,4,7,8,9,10) ) from a_program a where a.id_jenisanggaran = 2;