Solved

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

Posted on 2009-05-13
4
394 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:TraciShultz
  • 4
4 Comments
 
LVL 6

Expert Comment

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

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_24405310.html
0
 
LVL 6

Expert Comment

by:bull_rider
ID: 24381385
Can you mark it answered here as well?
0
 
LVL 6

Expert Comment

by:bull_rider
ID: 24381643
Hi TraciShultz,

Could you please mark this question answered?

Thanks.
0
 
LVL 6

Accepted Solution

by:
bull_rider earned 500 total points
ID: 24387085
Please mark the question answered.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to print the sql query 18 51
SQL Merige returns error code when updating 15 51
Stored procedure 4 32
Record open by another user 6 50
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now