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
 SQL Server Development (2000)
 Update record question

Author  Topic 

Incognito
Starting Member

49 Posts

Posted - 2002-02-03 : 09:32:38
Hello,

I try to update several records comparing to another table.
I got when I execute I get the error:

Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

Do someone have any suggestions?

My query is:

Update Dmisre01

SET zoeknaam =

(Select Distinct Klanten.FirmaID
From Dmisre01, Klanten, Klantadressen
Where Klanten.FirmaID = Klantadressen.FirmaID and
Postcode = Postpostkode and Telefoonre01 = Telefoon)

WHERE Zoeknaam IN

(Select Dmisre01.Zoeknaam
From Dmisre01, Klanten, Klantadressen
Where Klanten.FirmaID = Klantadressen.FirmaID and
Postcode = Postpostkode and Telefoonre01 = Telefoon)

Nazim
A custom title

1408 Posts

Posted - 2002-02-03 : 10:07:24
Try on this lines
Update D
SET D.zoeknaam =k.firmaid
from Dmisre01 d, Klanten k , Klantadressen ka
Where K.FirmaID = Ka.FirmaID and
d.postcode = Postpostkode and Telefoonre01 = Telefoon

About your Error
A subquery when compared with =, !=, <, <= , >, >= expects only one value and yours is returning multiple values , thus the error.



--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page
   

- Advertisement -