UPDATE TABLE1,TABLE2 WHERE TABLE1.SUBST_ID = TABLE2.SERIAL_ID SET TABLE2.BRANCH_ID = TABLE1.CREATED_ID;我觉得这应该管用但以我的经验,我可以说,这种方式是如此缓慢,不建议它!除tom的回答外,如果您需要频繁重复操作并想节省时间,您可以:在sql中使用内部连接查询进行更新非常简单,不需要使用FROM条款。举个例子:
UPDATE TABLE1,TABLE2 WHERE TABLE1.SUBST_ID = TABLE2.SERIAL_ID SET TABLE2.BRANCH_ID = TABLE1...
AFTER UPDATE ON DB1.264_P FOR EACH ROW BEGIN UPDATE DB2.264_P SET Source_Name = NEW.Source_Name, Source_Detail_Name = NEW.Source_Detail_Name, P_NPI_Number = NEW.P_NPI_Number, P_First_Name = NEW.P_First_Name, P_Middle_Name = NEW.P_Middle_Name, ...
参考链接: [MySQL UPDATE JOIN: Updating Data in One Table Based on Values from Another Table]( [MySQL INNER JOIN]( 开始 经验丰富的开发者->新手 步骤1 经验丰富的开发者->新手 步骤2 经验丰富的开发者->新手 步骤3 经验丰富的开发者->新手 步骤4 经验丰富的开发者->新手 结束 经验丰富的开发者-->...
SHOW CREATE TABLE shows a CREATE TABLE statement, which provides even more details on the table: mysql> SHOW CREATE TABLE cats\G *** 1. row *** Table cats Create Table: CREATE TABLE `cats` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(150) NOT NULL, `gender...
VALUES(@@identity,’some value’) 如果表mytable有一个标识字段,该字段的值会插入表anothertable的another_first字段。这是因为变量@@identity总是保存最后一次插入标识字段的值。 字段another_first应该与字段first_column有相同的数据类型。但是,字段another_first不能是应该标识字段。Another_first字段用来保存字段firs...
Statement-based replication stops if a single SQL statement operates on both a table that is included by a --replicate-do-table or --replicate-wild-do-table option, and another table that is ignored by a --replicate-ignore-table or --replicate-wild-ignore-table option. The slave must eith...
If you have a problem with indexes not being used when you believe that they should be, run ANALYZE TABLE to update table statistics, such as cardinality of keys, that can affect the choices the optimizer makes. 2 EXPLAIN Output Format ...
version 4.0 or higher you can update a table by joining two or more tables together; note that the examples shown in this article are not possible with MySQL 3.23 or earlier. By joining two tables together you can update one table based on fields in associated records in another table. ...
Re: Update from another table 1228 Peter Brawley August 30, 2007 01:40PM Sorry, you can't reply to this topic. It has been closed. Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represe...