View Single Post

   
  #3 (permalink)  
Old 02-29-2008, 07:48 AM
Erland Sommarskog
 
Posts: n/a
Default Re: SELECT works but UPDATE fails. ?

kalamos (kmcclare@hotmail.com) writes:
> This statement fails
> update ded_temp a
> set a.balance = (select sum(b.ln_amt)
> from ded_temp b
> where a.cust_no = b.cust_no
> and a.ded_type_cd = b.ded_type_cd
> and a.chk_no = b.chk_no
> group by cust_no, ded_type_cd, chk_no)


update ded_temp
set a.balance = (select sum(b.ln_amt)
from ded_temp b
where a.cust_no = b.cust_no
and a.ded_type_cd = b.ded_type_cd
and a.chk_no = b.chk_no
group by cust_no, ded_type_cd, chk_no)
from ded_temp a

None of the syntaxes are in line with standard SQL, so different enginge
have added different place where you can put in the alias.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Reply With Quote