1、批量修改
UPDATE '表名' SET listdir = CASE aid WHEN 1000 THEN '/labels/2840' WHEN 2851 THEN '/labels/2841' END WHERE aid IN (2850,2851)
2、查询重复
select keyword,count(*) as count from '表名' group by keyword having count>1;
3、删除重复
DELETE FROM '表名' WHERE keyword IN (SELECT keyword FROM (SELECT keyword FROM '表名' GROUP BY keyword HAVING COUNT(keyword)>1) e) AND aid NOT IN (SELECT aid FROM (SELECT MIN(aid) AS aid FROM '表名' GROUP BY keyword HAVING COUNT(keyword)>1) t)
标签: mysql
上面是“mysql语句之批量修改、查询重复、删除重复”的全面内容,想了解更多关于 mysql 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_1470.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!