Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8136698
  • 博文数量: 594
  • 博客积分: 13065
  • 博客等级: 上将
  • 技术积分: 10324
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-26 16:44
个人简介

推荐: blog.csdn.net/aquester https://github.com/eyjian https://www.cnblogs.com/aquester http://blog.chinaunix.net/uid/20682147.html

文章分类

全部博文(594)

分类: Mysql/postgreSQL

2011-02-12 10:34:17

-- 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`);
阅读(4243) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~