清理disuz垃圾用户信息SQL语句

4247阅读 0评论2011-02-12 Aquester
分类:Mysql/postgreSQL

-- hadoop开头的是UCenter表,cdb开头的是BBS部分的表

-- 搜索出所有垃圾用户名:
select `hadoop_members`.`username` from `hadoop_members` left join `cdb_members` on `hadoop_members`.`username`=`cdb_members`.`username` where `cdb_members`.`username` is null;
select `hadoop_members`.`username` from `hadoop_members` where not exists (select `cdb_members`.`username` from `cdb_members` where `hadoop_members`.`username`=`cdb_members`.`username`);

-- 搜索出垃圾用户个数:
select count(`hadoop_members`.`username`) from `hadoop_members` left join `cdb_members` on `hadoop_members`.`username`=`cdb_members`.`username` where `cdb_members`.`username` is null;
select count(`hadoop_members`.`username`) from `hadoop_members` where not exists (select `cdb_members`.`username` from `cdb_members` where `hadoop_members`.`username`=`cdb_members`.`username`);

-- 删除垃圾用户
delete from `hadoop_members` where not exists (select 1 from `cdb_members` where `hadoop_members`.`username`=`cdb_members`.`username`);
上一篇:高质量C++编程补充条款
下一篇:解决C++代码单元测试中的难题-不可验证和IO调用