|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need Help with update
Hello, I am having a small problem with an update query.
here is what I have: Code:
UPDATE [_SMDBA_].[_TELMASTE_] set [_SMDBA_].[_TELMASTE_].[SEQ_TEAM_ASSIGNMENTS] = [_SMDBA_].[CAI_TEAMMEMS].[SEQUENCE] FROM [_SMDBA_].[_TELMASTE_] inner join [_SMDBA_].[CAI_TEAMMEMS] ON [_SMDBA_].[_TELMASTE_].[SENT TO] = [_SMDBA_].[CAI_TEAMMEMS].[SEQSUPPORTSTAFF] AND [_SMDBA_].[_TELMASTE_].[SEQ_SUPPORT_TEAM] = [_SMDBA_].[CAI_TEAMMEMS].[SEQ_SUPPORT_TEAM] AND [_SMDBA_].[_TELMASTE_].[Seq_Team_Assignments] is null I am getting an error 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. Now what I am wondering is how to even begin to fix it. It should obviously return 1 or 0 values for each row of this Telmaste table. I have used similar queries before, and am wondering what I may be missing. Any ideas or suggestions are appreciated! |
|
#2
|
||||
|
||||
|
How many values does it return when you run that subquery that you're trying to set it to?
Probably more than one. Sounds like you need some more criteria. |
|
#3
|
|||
|
|||
|
It returns 1 value for each row that meets the criterea. It isn't returning any duplicate vaues or anything like that. It should look at each row and update it accordingly with those conditions. There really isn't any more critera I can use as this will need to update 2000+ records
|
|
#4
|
||||
|
||||
|
let's try changing your query just a little, to use a table alias
Code:
update [_SMDBA_].[_TELMASTE_]
set [SEQ_TEAM_ASSIGNMENTS] = [_SMDBA_].[CAI_TEAMMEMS].[SEQUENCE]
from [_SMDBA_].[_TELMASTE_] as foo
inner
join [_SMDBA_].[CAI_TEAMMEMS]
on foo.[SENT TO] = [_SMDBA_].[CAI_TEAMMEMS].[SEQSUPPORTSTAFF]
and foo.[SEQ_SUPPORT_TEAM] = [_SMDBA_].[CAI_TEAMMEMS].[SEQ_SUPPORT_TEAM]
and foo.[Seq_Team_Assignments] is null
|
|
#5
|
|||
|
|||
|
Thanks for the replay, unfortunatly it has the same result
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Need Help with update |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|