0
点赞
收藏
分享

微信扫一扫

MySQL update select 结果

微言记 2022-07-12 阅读 162


需要用到​​INNER JOIN​​。

UPDATE `table_live` a
INNER JOIN (
SELECT
GROUP_CONCAT(c.id) AS group_ids,
ingroup
FROM
`table_live` c
WHERE
ingroup = 11245
) AS b ON a.id = b.ingroup
SET a.groupliveids = b.group_ids
WHERE
a.id = 11245;

参考:https://dev.mysql.com/doc/refman/8.0/en/update.html


举报

相关推荐

0 条评论