日期:2014-05-16 浏览次数:20430 次
1 create table USERCOMPANYINFO_tmp as ( select * from USERCOMPANYINFO where rowid not in (SELECT A.ROWID FROM USERCOMPANYINFO A,(SELECT MAX(A.ROWID) RROWID,COMPANY FROM USERCOMPANYINFO A GROUP BY A.COMPANY HAVING COUNT(*) > 3) B WHERE A.COMPANY = B.COMPANY AND A.ROWID <> B.RROWID)) 2 alter table USERCOMPANYINFO disable primary key cascade; //清除外部引用 3 truncate table USERCOMPANYINFO;//清空数据 4 insert into USERCOMPANYINFO select * from USERCOMPANYINFO_tmp; //蒋临时表中的数据倒入目标数据 5 alter table USERCOMPANYINFO enable primary key; //给目标数据表添加主键约束
1 create table UUSER_temp as( select * from UUSER t where t.userid in(select u.userid from USERCOMPANYINFO u )) --讲uuser表中的需要的数据 保存到临时表中 2 drop uuser;//删除表 3 create table UUSER as select * from UUSER_temp 4 drop UUSER_temp;
1 create table USERINFO_temp as( select * from USERINFO t where t.userinfoid in(select u.userinfoid from USERCOMPANYINFO u )) --讲uuser表中的需要的数据 保存到临时表中 2 drop USERINFO;//删除表 3 create table USERINFO as select * from USERINFO_temp 4 drop USERINFO_temp