From 4a537e9aefe46a270a4e748ec393c3f1a5c0edb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Aug 2002 21:24:12 +0300 Subject: fixed two bugs in multi-table update --- mysql-test/r/multi_update.result | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'mysql-test/r/multi_update.result') diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index de955240de2..328eb9b394e 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -100,3 +100,38 @@ id mydate 6 2002-06-22 00:00:00 7 2002-07-22 00:00:00 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; +ID ParId tst tst1 +1 1 NULL NULL +2 2 NULL NULL +3 3 NULL NULL +UPDATE child, parent +SET child.tst = parent.tst, +child.tst1 = parent.tst1 +WHERE child.ParId = parent.Id; +select * from child; +ID ParId tst tst1 +1 1 MySQL MySQL AB +2 2 MSSQL Microsoft +3 3 ORACLE ORACLE +drop table parent, child; -- cgit v1.2.1