1 求出A表中每个月的注册用户,regedate格式是yyyy/mm/dd
select * from a where to_char(regedate,'yyyymm')='201305'
2 求出A表中所有姓名相同的用户
select * from a where name in (select name from a group by name having count(1)>1)
3 A 表中有相同名字的用户,把相同的选出来放入C表中
insert into c select a.id,a.name from a where name in (select name from a group by name having count(1)>1)
4 A 表中姓名相同的id,保留注册最大时间的用户
delete from a where a.id in (select id from c) and a.regedate not in (select max(regedate) from a group by id)