Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Simple UPDATE

Author  Topic 

Crespo

85 Posts

Posted - 2002-10-31 : 07:47:22
UPDATE AVCI
SET AVC_SOURCE = (SELECT A.AVC_SOURCE FROM
(SELECT DISTINCT MEMBER_KEY, AVC_SOURCE, CONTRIBUTION_TYPE FROM AVC AS A
INNER JOIN AVCI_AMMAR) AS B
ON A.MEMBER_KEY = B.MEMBER_KEY) C
WHERE AVCI.MEMBER_KEY = C.MEMBER_KEY)

Why doesn't this work?!

Best Regards.

Crespo.
Hewitt Bacon & Woodrow
Epsom
Surrey
United Kingdom

nr
SQLTeam MVY

12543 Posts

Posted - 2002-10-31 : 08:00:58
You have
FROM AVC AS A
INNER JOIN AVCI_AMMAR

with no join fields which is invalid.
Use cross join instead of inner join if that is really what you want.

Suggest you look at what you are trying to do though.
Did you know that you can do an update via

update tbl
set fld = fld
from tbl t1
inner join tbl2 t2
on ...

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Crespo

85 Posts

Posted - 2002-10-31 : 08:15:10
Thanks for your answer,

I can not believe I did not spot that stupid error. Oops!

Yea I know how to do updates but for what I am trying to do it is not that easy I'm afraid.

Cheers big ears.

Best Regards.

Crespo.
Hewitt Bacon & Woodrow
Epsom
Surrey
United Kingdom
Go to Top of Page
   

- Advertisement -