"Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message
news:eUXbUDkNFHA.508@TK2MSFTNGP12.phx.gbl...
> Try:
>
> CREATE PROCEDURE ARCustomerRebalance
> AS
> BEGIN
> SET NOCOUNT ON
>
> update cust_detail
> set curr_bal =
> (select sum(ar_master.bal_amt)
> from ar_master
> where cust_detail.cust_code = ar_master.cust_code)
> WHERE EXISTS
> (select *
> from ar_master
> where cust_detail.cust_code = ar_master.cust_code)
> END
>
>
> --
> Adam Machanic
> SQL Server MVP
>
http://www.datamanipulation.net > --
>
>
> "Philip L Holmes" <Phil@itp.uk.com> wrote in message
> news:%23xhj0KfNFHA.3988@tk2msftngp13.phx.gbl...
> > Is it possible to update for a group statement, I want to do the
following
> > but keep getting errors :
> >
> > CREATE PROCEDURE ARCustomerRebalance AS
> > begin
> > update cust_detail
> > set curr_bal = (select(sum(ar_master.bal_amt))
> > from cust_detail, ar_master
> > where (cust_detail.cust_code = ar_master.cust_code)
> > group by cust_detail.cust_code )
> >
> > end
> >
> > Thanks in advance
> >
> >
>
>