Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update subquery error

Status
Not open for further replies.

ibjolley

IS-IT--Management
Jan 4, 2002
8
US
Hello everyone. I know this has been discussed previously, but I'm have having issues with the following update statement:

UPDATE CPES_AllItems
SET ItemTypeID =
(SELECT basicinfo.BasicInfoItemtypeID
FROM basicinfo, CPES_Allitems
WHERE basicinfo.basicinfoid =
CPES_AllItems.basicinfoid)

I am trying to update the CPES_AllItems.ItemTypeID with BasicInfo.BasicInfoItemTypeID.

The error I receive says: Subquery returned more than 1 value. This is not permitted the subquery follows = or when the subquery is used as an expression.

I think my problem may be with the join. I appreciate any help/advise!

-andrew
 

Try the following syntax.

UPDATE CPES_AllItems
SET ItemTypeID = basicinfo.BasicInfoItemtypeID
FROM CPES_Allitems Inner Join basicinfo
ON CPES_AllItems.basicinfoid = basicinfo.basicinfoid Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
That worked. Thank you very much Terry!

Have a good one!

-andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top