我有一张表,其中有多个基于多列的重复数据。我想出了这个查询查找所有重复的行如何根据多个列更新数据库中的一组重复行
select *
from polls
group by server_id, product_id, poll_date
having count(*) > 1;
如何更新这些结果,并设置“updated_by”字段为“admin”。
我试着这样做,但它不会对我的帮助工作:(
update polls
set updated_by='admin'
group by server_id, product_id, poll_date
having count(*) > 1;
感谢
嗨。你可以给sql代码创建你的表并插入一些示例行? –