You are here: Re: SELECT works but UPDATE fails. ? « MsSQL Server « IT news, forums, messages
Re: SELECT works but UPDATE fails. ?

Posted by kalamos on 06/04/05 03:51

This is exactly the answer I was looking for, so simple yet so difficult to
find.

thanks for your help
:)


"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns966A612BFC362Yazorman@127.0.0.1...
> 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/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация