数据库去空格 去table 去回车符号 去重

1 update bd_prod_cate c set c.cate_name = replace(c.cate_name,chr(9),'')//去掉tab符号的
2 update bd_prod_cate c set c.cate_name = replace(c.cate_name,chr(10),'')//去掉回车符号的
3 update bd_prod_cate c set c.cate_name = trim(c.cate_name)//去掉空格符号的

delete from tabname t1
 where rowid <> (select min(rowid)
                   from tabname  t2
                  where t1.col_name = t2.col_name
                    and t1.id != t2.id);

delete from userinfo where sss in
(select sss from
(select sss from userinfo group by sss having count(sss)>1) tmp1)
and id not in
(select id from
(select min(id) id from userinfo group by sss having count(sss)>1) tmp2);
原文地址:https://www.cnblogs.com/Struts-pring/p/11045309.html