You're just joining against the subquery. You should see by running it on
its own, there is exactly one row per region. This is what you are joining
against when you run the update.
...
>> I have a table Regions with the region_id and region_sate. I am trying to add a new column so that when I run my query I get a total sales for that region.<<
Why are you adding a computed column to a table ??!!
Why did you use MONEY -- a non-ANSI data type with mathematical
problems, of the love of Ghod!!
Real SQL programmers do it with a VIEW that is always correct. Write a
VIEW!!
CREATE VIEW RegionWithTotals
AS
SELECT <<no idea because of crappy specs >>,
FROM Regions
WHERE .. ;
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it. Just basic netiquette, please. We are doing your job for you
and you should show us basic Netiquette.
Oh, you need to read and learn ISO-11179 naming rules and how to
format SQL. You have just been told by someone who helped write that
your code and approach stink. Learn, before you hurt or kill
someone.
-----------------------------------------------Reply-----------------------------------------------
"--CELKO--" <jcelko
@earthlink.net> wrote in message
news:1181068569.848068.290610@w5g2000hsg.googlegroups.com..
> Real SQL programmers do it with a VIEW that is always correct. Write a
> VIEW!!
Real SQL programmers should stick to their sandbox and recuse themselves
from application development. You flash ignorance like a streaker.
> Oh, you need to read and learn ISO-11179 naming rules and how to
> format SQL. You have just been told by someone who helped write that
> your code and approach stink.
You want credit for something a mile wide and an inch deep.
And one still needs boots.
www.beyondsql.blogspot.com