mysql - How to update the values of a single column with the result of a query? -
i'm having problem getting query work in mysql:
update proyects_c set director=(select users.keyid users,proyects users.username=proyects.director );
now problem subquery returns more 1 row. thing is, want. number of rows returns same number of rows in proyects_c, hence expected update every row in column director result of query.
however error:
error 1242 (21000) @ line 23: subquery returns more 1 row
which makes sense, can't want. doing wrong?
as secondary question, how can split 2 queries? clarity's sake.
maybe :
update proyects_c p inner bring together users u on u.username = p.director set p.director = u.keyid
mysql sql
No comments:
Post a Comment