~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
stop slave;
2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
3
reset master;
4
reset slave;
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
6
start slave;
7
drop table if exists t1,t2;
8
CREATE TABLE t1 (
9
a int unsigned not null auto_increment primary key,
10
b int unsigned
11
) ENGINE=MyISAM;
12
CREATE TABLE t2 (
13
a int unsigned not null auto_increment primary key,
14
b int unsigned
15
) ENGINE=MyISAM;
16
INSERT INTO t1 VALUES (NULL, 0);
17
INSERT INTO t1 SELECT NULL, 0 FROM t1;
18
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
19
SELECT * FROM t1 ORDER BY a;
20
a	b
21
1	0
22
2	0
23
SELECT * FROM t2 ORDER BY a;
24
a	b
25
1	0
26
2	1
27
UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
28
SELECT * FROM t1 ORDER BY a;
29
a	b
30
1	4
31
2	5
32
SELECT * FROM t2 ORDER BY a;
33
a	b
34
1	0
35
2	1
36
SELECT * FROM t1 ORDER BY a;
37
a	b
38
1	4
39
2	5
40
SELECT * FROM t2 ORDER BY a;
41
a	b
42
1	0
43
2	1
44
drop table t1,t2;
45
reset master;
46
CREATE TABLE t1 ( a INT );
47
INSERT INTO t1 VALUES (0);
48
UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
49
select * from t1;
50
a
51
3
52
select * from t1;
53
a
54
3
55
drop table t1;