2001-09-28 07:05:54 +02:00
|
|
|
drop table if exists t1,t2;
|
|
|
|
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
|
|
|
|
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
|
|
|
|
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
|
|
|
|
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
|
|
|
|
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
|
2001-11-08 13:17:56 +01:00
|
|
|
Duplicate entry '16' for key 1
|
|
|
|
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
|
2001-09-28 07:05:54 +02:00
|
|
|
select * from t2;
|
2000-12-28 02:56:38 +01:00
|
|
|
payoutID
|
|
|
|
1
|
|
|
|
4
|
|
|
|
6
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
|
12
|
|
|
|
14
|
|
|
|
16
|
|
|
|
19
|
|
|
|
20
|
|
|
|
22
|
2001-09-28 07:05:54 +02:00
|
|
|
drop table t1,t2;
|
|
|
|
DROP TABLE IF EXISTS crash1,crash2;
|
|
|
|
CREATE TABLE `crash1` (
|
|
|
|
`numeropost` bigint(20) unsigned NOT NULL default '0',
|
|
|
|
`icone` tinyint(4) unsigned NOT NULL default '0',
|
|
|
|
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
|
|
|
|
`contenu` text NOT NULL,
|
|
|
|
`pseudo` varchar(50) NOT NULL default '',
|
|
|
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
|
|
`ip` bigint(11) NOT NULL default '0',
|
|
|
|
`signature` tinyint(1) unsigned NOT NULL default '0',
|
|
|
|
PRIMARY KEY (`numeropost`,`numreponse`)
|
|
|
|
,KEY `ip` (`ip`),
|
|
|
|
KEY `date` (`date`),
|
|
|
|
KEY `pseudo` (`pseudo`),
|
|
|
|
KEY `numreponse` (`numreponse`)
|
|
|
|
) TYPE=MyISAM;
|
|
|
|
CREATE TABLE `crash2` (
|
|
|
|
`numeropost` bigint(20) unsigned NOT NULL default '0',
|
|
|
|
`icone` tinyint(4) unsigned NOT NULL default '0',
|
|
|
|
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
|
|
|
|
`contenu` text NOT NULL,
|
|
|
|
`pseudo` varchar(50) NOT NULL default '',
|
|
|
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
|
|
`ip` bigint(11) NOT NULL default '0',
|
|
|
|
`signature` tinyint(1) unsigned NOT NULL default '0',
|
|
|
|
PRIMARY KEY (`numeropost`,`numreponse`),
|
|
|
|
KEY `ip` (`ip`),
|
|
|
|
KEY `date` (`date`),
|
|
|
|
KEY `pseudo` (`pseudo`),
|
|
|
|
KEY `numreponse` (`numreponse`)
|
|
|
|
) TYPE=MyISAM;
|
|
|
|
INSERT INTO crash2
|
|
|
|
(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
|
|
|
|
(9,1,56,'test','joce','2001-07-25 13:50:53'
|
|
|
|
,3649052399,0);
|
|
|
|
INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
|
|
|
|
SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2
|
|
|
|
WHERE numeropost=9 ORDER BY numreponse ASC;
|
|
|
|
show variables like '%bulk%';
|
2001-07-26 15:57:34 +02:00
|
|
|
Variable_name Value
|
2002-07-23 17:31:22 +02:00
|
|
|
bulk_insert_buffer_size 8388608
|
2001-09-28 07:05:54 +02:00
|
|
|
INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
|
|
|
|
SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2
|
|
|
|
WHERE numeropost=9 ORDER BY numreponse ASC;
|
|
|
|
DROP TABLE IF EXISTS crash1,crash2;
|
2003-05-24 16:43:53 +02:00
|
|
|
drop table if exists t1;
|
|
|
|
drop table if exists t2;
|
|
|
|
create table t1(a int, unique(a));
|
|
|
|
insert into t1 values(2);
|
|
|
|
create table t2(a int);
|
|
|
|
insert into t2 values(1),(2);
|
|
|
|
reset master;
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
Duplicate entry '2' for key 1
|
|
|
|
show binlog events;
|
|
|
|
Log_name Pos Event_type Server_id Orig_log_pos Info
|
|
|
|
master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
|
|
|
|
master-bin.001 79 Query 1 79 use test; insert into t1 select * from t2
|
|
|
|
drop table t1, t2;
|