· 8 years ago · Jul 16, 2018, 06:46 PM
1CREATE TABLE IF NOT EXISTS `scxpm_old_copy` (
2 `id` bigint( 20 ) NOT NULL AUTO_INCREMENT ,
3 `authid` varchar( 24 ) default NULL ,
4 `ip` varchar( 24 ) default NULL ,
5 `nick` varchar( 50 ) default NULL ,
6 `xp` bigint( 20 ) NOT NULL default '0',
7 `playerlevel` int( 11 ) NOT NULL default '0',
8 `skillpoints` int( 11 ) NOT NULL default '0',
9 `medals` tinyint( 4 ) NOT NULL default '4',
10 `health` int( 11 ) NOT NULL default '0',
11 `armor` int( 11 ) NOT NULL default '0',
12 `rhealth` int( 11 ) NOT NULL default '0',
13 `rarmor` int( 11 ) NOT NULL default '0',
14 `rammo` int( 11 ) NOT NULL default '0',
15 `gravity` int( 11 ) NOT NULL default '0',
16 `speed` int( 11 ) NOT NULL default '0',
17 `dist` int( 11 ) NOT NULL default '0',
18 `dodge` int( 11 ) NOT NULL default '0',
19 PRIMARY KEY ( `id` )
20) ENGINE = InnoDB DEFAULT CHARSET = latin1;
21
22INSERT INTO `scxpm_old_copy`
23 SELECT * FROM `scxpm_stats`
24;
25
26DELETE FROM `scxpm_stats` WHERE id IN
27(
28 SELECT c.id
29 FROM `scxpm_old_copy` c, (
30 SELECT id, authid
31 FROM `scxpm_old_copy`
32 GROUP BY authid
33 HAVING COUNT( authid ) > 1
34 ORDER BY id
35 ) t
36 WHERE c.authid = t.authid
37 AND c.id != t.id
38 ORDER BY c.authid, c.id
39);
40
41ALTER TABLE `scxpm_stats` ADD UNIQUE (`authid`);