老discuz直接升级至discuz x2

2012年 12月 03日 20:37

我这个是discuz 6.1吧。大概。。 版本忘记了。。 是gbk版本。 老论坛。在我17岁那年玩的 由于当时未满18.。随便上网 搜了个身份正。。拿去 beian了。 后来beian重申。。 哪能记得当时用的谁的。。。 就这样。。 beian被取消了。。 无奈啊。

现在放国外服务器上 挂着吧。

似乎转换有点麻烦 决定一个个 表的手工转换

INSERT INTO `qphome`.`cdb_ucenter_members` (`uid`, `username`, `password`, `email`, `myid`, `myidkey`, `regip`, `regdate`, `lastloginip`, `lastlogintime`, `salt`, `secques`) SELECT    uid,username,password,email,myid,myidkey,regip,regdate,lastloginip,lastlogintime,salt,secques 
FROM  `qphome_old`.`uc_members` 




    INSERT INTO `qphome`.`cdb_forum_thread` (`tid`,`fid`,`typeid`,`sortid`,`readperm`,`price`,`author`,`authorid`,`subject`,`dateline`,`lastpost`,`lastposter`,`views`,`replies`,`displayorder`,`highlight`,`digest`,`rate`,`special`,`attachment`,`moderated`,`closed`) select `tid`,`fid`,`typeid`,`sortid`,`readperm`,`price`,`author`,`authorid`,`subject`,`dateline`,`lastpost`,`lastposter`,`views`,`replies`,`displayorder`,`highlight`,`digest`,`rate`,`special`,`attachment`,`moderated`,`closed` from `qphome_old`.`cdb_threads`


        INSERT INTO `qphome`.`cdb_forum_forum` (`fid`,`fup`,`type`,`name`,`status`,`displayorder`,`styleid`,`threads`,`posts`,`todayposts`,`lastpost`,`allowsmilies`) select `fid`,`fup`,'forum' as `type`,`name`,`status`,`displayorder`,`styleid`,`threads`,`posts`,`todayposts`,`lastpost`,`allowsmilies` from `qphome_old.cdb_forums`
            

                INSERT INTO `qphome`.`cdb_forum_post` (`pid`,`fid`,`tid`,`first`,`author`,`authorid`,`subject`,`dateline`,`message`,`useip`,`invisible`,`anonymous`,`usesig`,`htmlon`,`bbcodeoff`,`smileyoff`,`parseurloff`,`attachment`,`rate`,`ratetimes`,`status`    )
                select `pid`,`fid`,`tid`,`first`,`author`,`authorid`,`subject`,`dateline`,`message`,`useip`,`invisible`,`anonymous`,`usesig`,`htmlon`,`bbcodeoff`,`smileyoff`,`parseurloff`,`attachment`,`rate`,`ratetimes`,`status`     from `qphome_old`.`cdb_posts`

INSERT INTO `qphome`.`cdb_common_member`
    (`uid`,`email`,`username`,`password`,`adminid`,`groupid`,`groupexpiry`,`extgroupids`,`regdate`,`credits`,`timeoffset`,`accessmasks` )
    select `uid`,`email`,`username`,`password`,`adminid`,`groupid`,`groupexpiry`,`extgroupids`,`regdate`,`credits`,`timeoffset`,`accessmasks` from `qphome_old`.`cdb_members`




INSERT INTO `qphome`.`cdb_forum_forumfield`(
`fid`,`description`,`password`,`icon`,`moderators`,`rules`,`threadtypes`,`threadsorts`,`viewperm`,`postperm`,`replyperm`,`getattachperm`,`postattachperm`,`keywords`,`supe_pushsetting`,`formulaperm`,`modrecommend`    
    ) select `fid`,`description`,`password`,`icon`,`moderators`,`rules`,`threadtypes`,`threadsorts`,`viewperm`,`postperm`,`replyperm`,`getattachperm`,`postattachperm`,`keywords`,`supe_pushsetting`,`formulaperm`,`modrecommend`   
from `qphome_old`.`cdb_forumfields`


UPDATE  `qphome`.`cdb_forum_forum` SET  `fup` =  '10' WHERE  `cdb_forum_forum`.`fid` in(11,12,13,14);
UPDATE  `qphome`.`cdb_forum_forum` SET  `fup` =  '83' WHERE  `cdb_forum_forum`.`fid` in(84,85,86,87,88,89,90,91,92,93,104,105);



            
                INSERT INTO `qphome`.`cdb_common_member_profile`(
    `uid`,`realname`,`gender`,`birthyear`,`birthmonth`,`birthday`,`alipay`,`icq`,`qq`,`yahoo`,`msn`,`taobao`,`site`,`bio`
        
        )(
        select f.uid,'' as `realname`,m.`gender`,YEAR(m.`bday`) as `birthyear`,MONTH(m.`bday`) as `birthmonth`,DAY(m.`bday`) as `birthday`,f.`alipay`,f.`icq`,f.`qq`,f.`yahoo`,f.`msn`,f.`taobao`,f.`site`,f.`bio`
        
from        `qphome_old`.`cdb_memberfields` as f left join `qphome_old`.`cdb_members` as m on f.`uid`=m.`uid`
        )
            


            INSERT INTO `qphome`.`cdb_common_member_count`(

    `uid`,`extcredits1`,`extcredits2`,`extcredits3`,`extcredits4`,`extcredits5`,`extcredits6`,`extcredits7`,`extcredits8`,`posts`,`threads`,`digestposts`,`views`,`oltime`
    
    ) select  `uid`,`extcredits1`,`extcredits2`,`extcredits3`,`extcredits4`,`extcredits5`,`extcredits6`,`extcredits7`,`extcredits8`,`posts`,`threads`,`digestposts`,`pageviews` as `views`,`oltime`
    from `qphome_old`.`cdb_members` 


    
                INSERT INTO `qphome`.`cdb_common_member_status`(
                
                    `uid`,`regip`,`lastip`,`lastvisit`,`lastactivity`,`lastpost`
                    )
                    select `uid`,`regip`,`lastip`,`lastvisit`,`lastactivity`,`lastpost`     from `qphome_old`.`cdb_members` 



INSERT INTO `cdb_ucenter_pm_lists`
(authorid, pmtype, subject, members, min_max, dateline,lastmessage) 
SELECT * from (SELECT msgfromid as authorid, 1 as pmtype, '' as subject, 2 as members, 
CONCAT(LEAST(msgfromid,msgtoid),'_',GREATEST(msgfromid,msgtoid)) as min_max, dateline, 
CONCAT('a:3:{s:12:"lastauthorid";s:',LENGTH(msgfromid),':"',msgfromid,'";s:10:"lastauthor";s:',LENGTH(msgfrom),':"',msgfrom,'";s:11:"lastsummary";s:',LENGTH(message),':"',LEFT(IF(LENGTH(subject) > 0 AND STRCMP(subject, message), CONCAT(subject, '\r\n', message), message),150),'";}') as lastmessage
FROM `uc_pms` 
WHERE related = 1 order by dateline desc) as tmp GROUP BY min_max;




INSERT INTO `cdb_ucenter_pm_members` (plid, uid, isnew, lastupdate) SELECT plid, SUBSTRING_INDEX(min_max, '_', 1), 0, 0 FROM `cdb_ucenter_pm_lists`;
INSERT INTO `cdb_ucenter_pm_members` (plid, uid, isnew, lastupdate) SELECT plid, SUBSTRING_INDEX(min_max, '_', -1), 0, 0 FROM `cdb_ucenter_pm_lists`;

ALTER TABLE  `cdb_ucenter_pm_indexes` ADD  `pmidold` INT NULL;




INSERT INTO `cdb_ucenter_pm_indexes` (plid, pmidold) SELECT l.plid, p.pmid FROM `uc_pms` p LEFT JOIN `cdb_ucenter_pm_lists` l ON CONCAT(LEAST(p.msgfromid, p.msgtoid), '_', GREATEST(p.msgfromid, p.msgtoid)) = l.min_max WHERE p.related = 1;




INSERT INTO `cdb_ucenter_pm_messages_0` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 0;
INSERT INTO `cdb_ucenter_pm_messages_1` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 1;
INSERT INTO `cdb_ucenter_pm_messages_2` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 2;
INSERT INTO `cdb_ucenter_pm_messages_3` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 3;
INSERT INTO `cdb_ucenter_pm_messages_4` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 4;
INSERT INTO `cdb_ucenter_pm_messages_5` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 5;
INSERT INTO `cdb_ucenter_pm_messages_6` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 6;
INSERT INTO `cdb_ucenter_pm_messages_7` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 7;
INSERT INTO `cdb_ucenter_pm_messages_8` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 8;
INSERT INTO `cdb_ucenter_pm_messages_9` (pmid, plid, authorid, message, delstatus, dateline) SELECT i.pmid, i.plid, p.msgfromid, IF(LENGTH(p.subject) > 0 AND STRCMP(p.subject, p.message), CONCAT(p.subject, '\r\n', p.message), p.message), IF(l.authorid = p.msgfromid, p.delstatus, IF(p.delstatus > 0, 3-p.delstatus, 0)), p.dateline FROM `cdb_ucenter_pm_indexes` i LEFT JOIN `uc_pms` p ON i.pmidold = p.pmid LEFT JOIN `cdb_ucenter_pm_lists` l ON i.plid = l.plid WHERE i.plid % 10 = 9;




UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_0` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 0 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_1` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 1 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_2` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 2 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_3` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 3 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_4` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 4 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_5` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 5 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_6` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 6 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_7` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 7 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_8` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 8 AND m.plid = msg.plid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, dateline FROM `cdb_ucenter_pm_messages_9` ORDER BY dateline DESC) msg SET m.lastdateline = msg.dateline WHERE m.plid % 10 = 9 AND m.plid = msg.plid;






UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_0` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 0 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_0` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 0 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_1` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 1 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_1` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 1 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_2` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 2 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_2` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 2 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_3` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 3 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_3` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 3 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_4` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 4 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_4` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 4 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_5` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 5 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_5` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 5 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_6` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 6 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_6` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 6 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_7` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 7 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_7` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 7 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_8` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 8 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_8` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 8 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_9` WHERE delstatus IN (0,1) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 9 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1), l.authorid) = m.uid;
UPDATE `cdb_ucenter_pm_members` m, (SELECT plid, count(*) as pmnum FROM `cdb_ucenter_pm_messages_9` WHERE delstatus IN (0,2) GROUP BY plid) msg, `cdb_ucenter_pm_lists` l SET m.pmnum = msg.pmnum WHERE m.plid % 10 = 9 AND m.plid = msg.plid AND m.plid = l.plid AND IF(SUBSTRING_INDEX(l.min_max, '_', 1) = l.authorid, l.authorid, SUBSTRING_INDEX(l.min_max, '_', -1)) = m.uid;






ALTER TABLE `cdb_ucenter_pm_indexes`
  DROP `pmidold`;







另外 discuz 的附件表 分表了 分成一个索引表 cdb_forum_attachment 还有0-9的附件详情表 cdb_forum_attachment_$1

根据 tid决定的最后一位决定存放的表

用php处理下把

query("select a.*,f.description from `cdb_attachments` as a left join `cdb_attachmentfields` as f on a.aid=f.aid  limit 9999999");
$a=0;
while($r=$db->fetch_array($query)){
    $tableid=substr($r['tid'],-1);
    $at[]=array('aid'=>$r['aid'],   'tid'=>$r['tid'],'pid'=>$r['pid'],'uid'=>$r['uid'],'tableid'=>$tableid,'downloads'=>$r['downloads']);
    $atb[$tableid][]=array(
    'aid'=>$r['aid'],
    'tid'=>$r['tid'],
    'pid'=>$r['pid'],
    'uid'=>$r['uid'],
    'dateline'=>$r['dateline'],
    'filename'=>daddslashes($r['filename']),
    'filesize'=>$r['filesize'],
    'attachment'=>$r['attachment'],
    'remote'=>0,
    'description'=>daddslashes($r['description']),
    'readperm'=>$r['readperm'],
    'price'=>$r['price'],
    'isimage'=>$r['isimage'],
    'width'=>$r['width'],
    'thumb'=>$r['thumb'],
    'picid'=>$r['picid'],
    );
    $a++;
    $atcount[$tableid]++;
    }
    echo "数量 :$a     \r\n";
$db->query("TRUNCATE TABLE `cdb_forum_attachment`");
    $sql="INSERT INTO `cdb_forum_attachment` (`aid`, `tid`, `pid`, `uid`, `tableid`, `downloads`) VALUES";
    foreach($at as $a){
        $sql.="('{$a['aid']}','{$a['tid']}','{$a['pid']}','{$a['uid']}','{$a['tableid']}','{$a['downloads']}'),";
        }
    $sql=substr($sql,0,-1); 
    $db->query($sql);
    for($i=0;$i<10;$i++){
            $db->query("TRUNCATE TABLE `cdb_forum_attachment_$i`");
$sql="INSERT INTO `discuz_new`.`cdb_forum_attachment_$i` (`aid`, `tid`, `pid`, `uid`, `dateline`, `filename`, `filesize`, `attachment`, `remote`, `description`, `readperm`, `price`, `isimage`, `width`, `thumb`, `picid`) VALUES ";
    foreach($atb[$i] as $a){
        $sql.="('{$a['aid']}','{$a['tid']}','{$a['pid']}','{$a['uid']}','{$a['dateline']}','{$a['filename']}','{$a['filesize']}','{$a['attachment']}','{$a['remote']}','{$a['description']}','{$a['readperm']}','{$a['price']}','{$a['isimage']}','{$a['width']}','{$a['thumb']}','{$a['picid']}'),";
        }
    $sql=substr($sql,0,-1); 
    //echo $sql;        
    $db->query($sql);
        echo "已完成 表 $i 共有  {$atcount[$i]} 条记录 \r\n";
        }

?>


只要熟悉 表结构。这些挺容易操作的 用这样的方法 可以把任意一个论坛系统自由的转来转去。