Skip to content
Advertisement

Updating all the record for a column in a table with value from another table

Hi I want to update all the values of RequestId column of IIL_CHANGE_REQUEST Table with the RequestId of TABLE_NAME_4MINS Table where REQUESTBY column in both tables are same. I am trying to do this in oracle daatabalse(sql developer)

My query:

But every time I do this I get an error saying:

Error report –

ORA-01427: single-row subquery returns more than one row

Please anyone help how can I do it.

Advertisement

Answer

It depends on what you want to do in such cases. If you don’t really care, take any value, for example minimum:

If that’s not what you want, then you’ll have to figure out what to do with those “duplicates”. Perhaps you’ll have to include yet another WHERE condition, or fix data, or … who knows? I don’t, while you should.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement