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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another Newbie Update question

Status
Not open for further replies.

VBAHole22

Programmer
Nov 7, 2002
41
US
I am just learning Oracle after having an Access SQL Server background and the SQL is killing me. The joins work so differently. If I just had some base code to start with I would be off and running.

What I am trying to do here is update a table (A) with a value that determine by looking at another table. Both tables have a common field that should be one to one (vPATH). The way I set it up below I get the 'subquery returns more than one result error'. I know the subquery returns more than one row, I want to update all vPATH values in A where the subquery returns results.
Any suggestions?


UPDATE A
SET A.UNIT = 'M' WHERE
A.vPATH =
(SELECT B.vPATH
FROM B WHERE
B.X_CENTROID < 3850000 AND B.X_CENTROID > 3000000
AND B.Y_CENTROID < 2250000 AND B.Y_CENTROID > 980000)
 
Code:
UPDATE A 
SET A.UNIT = 'M' WHERE
A.vPATH [COLOR=red]IN[/color]
(SELECT B.vPATH 
FROM B WHERE
B.X_CENTROID < 3850000 AND B.X_CENTROID > 3000000 
AND B.Y_CENTROID < 2250000 AND B.Y_CENTROID > 980000)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top