Im trying to copy some field from a table to other, I want to do iy by using insert with a subquery like this:
insert into sed_reporte_generico
(srg_usuario,
srg_nombres,
srg_ape_paterno,
srg_ape_materno,
srg_objetivo,
srg_peso_ob,
srg_calf_ob)
values
(
(select us.su_st_usuario, us.su_st_nombres, us.su_st_ap_paterno, us.su_st_ap_materno, ob.soc_st_descripcion, ob.soc_nr_peso,ob.soc_nr_calificacion
from sed_objetivo ob, sed_usuarios us, sed_evaluacion ev
where ob.se_evaluacion_pk = ev.se_evaluacion_pk and ev.su_colaborador_fk = us.su_usuarios_pk)
);
but I got this error:
01427. 00000 - "single-row subquery returns more than one row"
any idea how should I do this?
Thanks,
Think you got to choose between
and
You can have VALUES and SELECT mixed only (as pointed by an anomyous horse) when your select query returns only one column and one row !
By the way, use JOIN... to Join your tables (use of the WHERE clauses to join tables is rather a bad habit) :