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.
| Author |
Topic |
|
stevo_3
Starting Member
20 Posts |
Posted - 2006-01-10 : 08:04:34
|
Hello,Tabel: workitem: id(key), officeid, contact_id 1, 55750 , 20Tabel: contact: id(key), title, 2 , 55750The values of workitem.officeid and contact.title are the same,i want to update the workitem.contact_id field of workitem, lookup and put in the key here from contact (id). wich is 2 in this case UPDATE workitemSET contact_id= (select id FROM contact WHERE contact.title = workitem.officeid)WHERE EXISTS ( select contact.id FROM contact WHERE contact.title = workitem.officeid); when i do this he gives me the folowwing error:Server: Msg 512, Level 16, State 1, Line 1Subquery 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.(8 row(s) affected)(4895 row(s) affected)Anyone has an idea ?ThxSteve |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-10 : 08:10:45
|
| Before Trying this make sure you have latest BackupUPDATE WSET W.contact_id= C.id FROM workitem W inner join contact CON W.officeid=C.title MadhivananFailing to plan is Planning to fail |
 |
|
|
stevo_3
Starting Member
20 Posts |
Posted - 2006-01-10 : 08:20:16
|
It worksjippieeeeeeeThxSteve |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-10 : 08:32:47
|
>>jippieeeeeeeWhat does it mean? MadhivananFailing to plan is Planning to fail |
 |
|
|
stevo_3
Starting Member
20 Posts |
Posted - 2006-01-10 : 10:32:38
|
It is like YES it works or like huray we're going to Mc Donalds |
 |
|
|
|
|
|
|
|