darren@xxxxxxxxx wrote:
Normally you do have to look out for multiple records trying to be assigned
to the SET value, however, Sum(InvAmt), is being used, so multiple records
will not cause an error.

You are of course correct. Since the SELECT is using an aggregating function, you don't need that.

Although that begs the question: why not set the value in OpenAR to zero when no records exist? Then you could just use:

Update OpenAR Set Amount =
(Select COALESCE(Sum(InvAmt),0) from InvHde
where Company = InvCmpny and Customer = InvCust)


Joe

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].