mysql - Subquery returns more than 1 row, Error 1242 -
i new mysql, can guys please me in this?
query:
update users u, posts p set u.tags = (select group_concat(tags) (select distinct tags, user_id posts group tags, user_id) p group user_id) u.user_id = p.user_id;
error:
error 1242 (21000): subquery returns more 1 row
you need correlated subquery:
update users u set u.tags =(select group_concat(distinct tags) posts p p.user_id = u.user_id group user_id )
i'm not sure query doing. has join on outside unnecessary. grouping tags , user_id on inside, unnecessary distinct
keyword. subquery producing different value each user_id
, no wonder getting error of many rows returned. set
statement can have 1 value.
Comments
Post a Comment