我想根据字段更新列值。意味着根据attribute_id(46)更新entity_id (可能是13,或其他什么),因为对于不同的实体,有不同的entity_ids。attribute_id(46)将从attribute_id(132) .What中获取数据作为这个过程的查询吗?详情请见截图。

发布于 2022-04-24 07:47:29
使用此类型的查询使用where条件从表中更新相同的表字段。(对不起,此查询未在sql中进行测试)
UPDATE t2
SET attribute_id = (select attribute_id from xxtable t2 where attribute_id = 132)
FROM xxtable t2
where attribute_id = 46发布于 2022-04-24 07:52:45
您可以使用这样的查询:
UPDATE `tablename` a
INNER JOIN `tablename` b
ON b.attribute_id = 132 AND b.entity_id = b.entity_id
SET a.value = b.value
WHERE a.attribute_id = 46 AND a.entity_id = 13 ;https://stackoverflow.com/questions/71986300
复制相似问题