工作 · · 637 阅读

一些以前用过的sql语句

old
# 将数据库字段中的特殊字符替换
UPDATE my_article_content SET content=REPLACE(content,'”',''),content=REPLACE(content,'“',''),content=REPLACE(content,' ',''),content=REPLACE(content,'…','')

# 查找重复记录
SELECT count(id) ids  FROM may_private_art  GROUP BY title  order by ids desc

# 删除重复数据
DELETE FROM `may_private_art` WHERE id NOT IN(SELECT * FROM(SELECT id FROM `may_private_art` GROUP BY title)AS b)