Link to home
Start Free TrialLog in
Avatar of TraciShultz
TraciShultzFlag for United States of America

asked on

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

I am hoping someone can explain how to correctly update multiple records in a table using subqueries.

I have one table that 2 fields. The subqueries are returning the correct values for the set and the Where Exists is returning the correct records to update.

any help is greatly appreciated.
UPDATE    TempFinalTubeListMoves
	SET              DestRackRow =
							  (SELECT     TempRecompileLastRackPositions.Row AS DestRackRow
								FROM          TempLastDestRack INNER JOIN
													   TempRecompileLastRackPositions ON TempLastDestRack.Ident = TempRecompileLastRackPositions.Ident INNER JOIN
													   TempFinalTubeListMoves AS TempFinalTubeListMoves ON TempLastDestRack.bc = TempFinalTubeListMoves.bc), 
						  DestRackColumn =
							  (SELECT     TempRecompileLastRackPositions.Col AS DestRackCol
								FROM          TempLastDestRack AS TempLastDestRack INNER JOIN
													   TempRecompileLastRackPositions AS TempRecompileLastRackPositions ON 
													   TempLastDestRack.Ident = TempRecompileLastRackPositions.Ident INNER JOIN
													   TempFinalTubeListMoves AS TempFinalTubeListMoves ON TempLastDestRack.bc = TempFinalTubeListMoves.bc)
	WHERE  EXISTS  
							  (SELECT     *
								FROM          TempLastDestRack AS TempLastDestRack INNER JOIN
													   TempRecompileLastRackPositions AS TempRecompileLastRackPositions ON 
													   TempLastDestRack.Ident = TempRecompileLastRackPositions.Ident INNER JOIN
													   TempFinalTubeListMoves AS TempFinalTubeListMoves ON TempLastDestRack.bc = TempFinalTubeListMoves.bc)

Open in new window

Avatar of bull_rider
bull_rider
Flag of India image

Its the same question you are asking again but for different query. Have the answer here:

https://www.experts-exchange.com/questions/24405310/Subquery-returned-more-than-1-value-Error.html
Can you mark it answered here as well?
Hi TraciShultz,

Could you please mark this question answered?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of bull_rider
bull_rider
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial