diff options
Diffstat (limited to 'mysql-test/t/multi_update.test')
-rw-r--r-- | mysql-test/t/multi_update.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index acc816ae921..04c33e9d709 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -532,3 +532,33 @@ select * from t1; select * from t2; drop view v1; drop table t1, t2; + +# +# Test multi updates and deletes using primary key and without. +# +create table t1 (i1 int, i2 int, i3 int); +create table t2 (id int, c1 varchar(20), c2 varchar(20)); +insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from t1 order by i1; +select * from t2; +update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +delete t1.*,t2.* from t1,t2 where t1.i2=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +drop table t1, t2; +create table t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)); +create table t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)); +insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from t1 order by i1; +select * from t2 order by id; +update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +delete t1.*,t2.* from t1,t2 where t1.i2=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +drop table t1, t2; |