diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2002-08-06 21:24:12 +0300 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2002-08-06 21:24:12 +0300 |
commit | 4a537e9aefe46a270a4e748ec393c3f1a5c0edb0 (patch) | |
tree | 20ebc04f2a457d781a022e136bcce1f766f75446 /mysql-test/t/multi_update.test | |
parent | 2cb480f2a8aa82df59e0dcde77c456118a332a8c (diff) | |
download | mariadb-git-4a537e9aefe46a270a4e748ec393c3f1a5c0edb0.tar.gz |
fixed two bugs in multi-table update
Diffstat (limited to 'mysql-test/t/multi_update.test')
-rw-r--r-- | mysql-test/t/multi_update.test | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index ab3d5a7fff6..205dbb10ccf 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -105,3 +105,38 @@ where to_days(now())-to_days(c.mydate)>=30 and c.id=a.id and c.id=b.id; select * from c; DROP TABLE IF EXISTS a,b,c; +drop table if exists parent, child; +CREATE TABLE IF NOT EXISTS `parent` ( + `id` int(11) NOT NULL auto_increment, + `tst` text, + `tst1` text, + PRIMARY KEY (`id`) +) TYPE=MyISAM; + +CREATE TABLE IF NOT EXISTS `child` ( + `ID` int(11) NOT NULL auto_increment, + `ParId` int(11) default NULL, + `tst` text, + `tst1` text, + PRIMARY KEY (`ID`), + KEY `IX_ParId_child` (`ParId`), + FOREIGN KEY (`ParId`) REFERENCES `test.parent` (`id`) +) TYPE=MyISAM; + +INSERT INTO parent(tst,tst1) +VALUES("MySQL","MySQL AB"), ("MSSQL","Microsoft"), ("ORACLE","ORACLE"); + +INSERT INTO child(ParId) +VALUES(1), (2), (3); + +select * from child; + +UPDATE child, parent +SET child.tst = parent.tst, +child.tst1 = parent.tst1 +WHERE child.ParId = parent.Id; + +select * from child; + + +drop table parent, child;
\ No newline at end of file |