帝国论坛帝国网站管理系统交流区模板/标签/插件共享交流4.0删除标题重复的数据--3.7的代码不能用了 【本版专题贴子】  
主题:4.0删除标题重复的数据--3.7的代码不能用了 [加入收藏夹]   

racson
用户头衔:举人

精华贴   :0
发贴数   :160
经验值   :713
注册时间:2006-07-23
信息 搜索 好友 发送悄悄话 精益求精-帝国网站管理系统7.5正式版开源发布】   [第 1 楼]
4.0删除标题重复的数据--3.7的代码不能用了
CODE:[Copy to clipboard]/****建立临时表****/
create table phome_ecms_news_temp (id int(11) NOT NULL , classid smallint(6) NOT NULL, onclick int(11) NOT NULL, newspath varchar(50) NOT NULL, keyboard varchar(255) NOT NULL, keyid varchar(255) NOT NULL, userid int(11) NOT NULL, username varchar(30) NOT NULL, ztid text NOT NULL, checked tinyint(1) NOT NULL, istop tinyint(4) NOT NULL, truetime int(11) NOT NULL, ismember tinyint(1) NOT NULL, dokey tinyint(1) NOT NULL, userfen int(11) NOT NULL, isgood tinyint(1) NOT NULL, titlecolor varchar(10) NOT NULL, titlefont varchar(255) NOT NULL, titleurl varchar(200) NOT NULL, filename varchar(60) NOT NULL, filenameqz varchar(28) NOT NULL, fh tinyint(1) NOT NULL, groupid smallint(6) NOT NULL, newstempid smallint(6) NOT NULL, plnum int(11) NOT NULL, firsttitle tinyint(1) NOT NULL, checkuser text NOT NULL, docheckuser text NOT NULL, viewcheckuser text NOT NULL, returncheck tinyint(1) NOT NULL, notdocheckuser text NOT NULL, totaldown int(11) NOT NULL, title varchar(200) NOT NULL, newstime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, titlepic varchar(200) NOT NULL, wplay tinyint(1) NOT NULL, ftitle varchar(200) NOT NULL, smalltext text NOT NULL, writer varchar(30) NOT NULL, befrom varchar(60) NOT NULL, newstext mediumtext NOT NULL, closepl tinyint(1) NOT NULL, havehtml tinyint(1) NOT NULL, PRIMARY KEY (title), KEY classid (classid));
/****将原有数据导入临时表****/
insert ignore into phome_ecms_news_temp select distinct * from phome_ecms_news;
/****更改临时表主键为id****/
alter table phome_ecms_news_temp drop primary key, add primary key(id);
/****更改id属性为auto_increment****/
alter table phome_ecms_news_temp change id id int(11) not null auto_increment;
/****用重命名的方式备份原数据表****/
alter table phome_ecms_news rename phome_ecms_news_bak;
/****将临时表改名为phome_ecms_news****/
alter table phome_ecms_news_temp rename phome_ecms_news;
如果成功,在下次整理前先运行


CODE:[Copy to clipboard]drop table phome_ecms_news_bak;




2007-02-02 11:41:57 已设置保密 顶部 回复 引用 报告 编辑 删除

racson
用户头衔:举人

精华贴   :0
发贴数   :160
经验值   :713
注册时间:2006-07-23
信息 搜索 好友 发送悄悄话 免费开源-EBMA系统:更安全的MYSQL管理和备份系统】   [第 2 楼]

谁能把4.0的发上来,3.7不能用了




2007-02-02 11:42:21 已设置保密 顶部 回复 引用 报告 编辑 删除

快速回复
内容

表情
使用EBB代码 使用smile代码 显示签名 自动分析url 自动分析img
     【进入高级模式】   (按 Ctrl+Enter 直接提交)
    顶部  加入收藏夹
关于帝国 | 广告服务 | 联系我们 | 法律声明 | 隐私条款 | 许可协议
Powered by: EBB Version 2.2.1