I have some null values in my table, I have to update that values from other table. I am using the following query but the sub query returns more than one value.
update student st
set n_id=(select n_id
from class cl
where st.uid=cl.uid
and ( cl.start_date='31-jan-2011' or cl.start_date='28-feb-2011')
and st.n_id is null);
How can I update my field. Help me to find out. Thanks.
you could either work on the logic or add the statement
then your subquery will always return just one row (the first one.. if it exists)