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

Update multiple fields on table based on value in another table

Status
Not open for further replies.
Aug 22, 2003
20
US
I am kind of new to SQL programming.
I am trying to update multiple fields on a table based on criteria in another table. See code below:

Code:
UPDATE SHIP
   SET SHIP.DETACHED_HOUSE = 0, SHIP.ATTACHED_HOUSE = 0,    SHIP.PUD = 0, SHIP.CO_OP = 0, SHIP.CONDO = 1
   WHERE SHIP.AP_NUM = (SELECT T.AP_NUM FROM T WHERE        T.PROPERTY_TYPE  IN('CONDO', 'CONDO-HIGH', 'CONDO-LOW'))

I keep getting the following error:

Error number: -1427, position: 0-
ORA-01427: single row subquery returns more than one row

I understand why I get the error but I am having trouble getting past it to reach my goal.

Any help would be appreciated.

Thanks

Chad
 
Try changing your first WHERE clause to

[tt]WHERE SHIP.AP_NUM IN (SELECT T.AP_NUM FROM T...[/tt]

Does that give the desired result?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top