sql server - Subquery returned more than 1 value. SQL error -


this error has it. dont know do. please me.

subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression.

update kho /*set kho.xuat = sum(phieuxuat.sl)*/ set kho.xuat = (select sum(phieuxuat.sl) sluong phieuxuat group phieuxuat.mavt) kho inner join phieuxuat on (kho.mavt = phieuxuat.mavt) 

this means subquery returned more 1 row not allowed. can write update statement as:

update k      set k.xuat = (select sum(p.sl) phieuxuat p p.mavt = k.mavt) kho k 

note added where clause inside subquery. removed join prevent multiple updates on same row.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -