Question: I am trying to update a column based on another column in the same table (student table) and a column
from another table (school table)

Code is:

```
update student_table
set student_code =
(select l.student_code
from school_table l, student_table n
where l.school = n.schoolname)

```

I get the following error

ORA - 01427 Single-row subquery returns more than one row

Any help would be appreciated.

Answer: 
It would be helpful to have a plain English explanation of what you are trying to accomplish. Having said that, it appears to me that you can accomplish what you want to do with the following SQL [assuming one to many relationship between school\_table and student\_table] having the inner select as a corelated sub-query with the outer update statement:

```
update student_table 
set student_code = (select l.student_code 
                    from school_table 
                    where school_table.school = student_table.schoolname) 
;

```

Hope this helps.

Regards,
Roger
Try to add and rownum=1 to your subquery conditions if you DO NOT care about the value from the list or DO sure that they are the same.