1

我有

Update2 `Table1` AS T1 Inner Join `Table2` As T2
On T2.`Name` = T1.Name
Set T1.`ParentID` = T2.`ID`

我想先检查一下,在长周末后让大脑冻结,感谢帮助。

我基本上想先检查

Select FieldA, concat(FieldC,', ',FieldD) `Table1` AS T1 Inner Join `Table2` As T2
on T2.`Name` = T1.Name
Set T1.`ParentID` = T2.`ID`

以确保我得到正确的结果。

4

1 回答 1

1

等效的 SELECT 可以是:

SELECT T1.`ParentID` = T2.`ID`
FROM `Table1` AS T1 Inner Join `Table2` AS T2
  ON T2.`Name` = T1.Name

pt-query-digest是一个将 UPDATE 转换为 SELECT 以便它可以运行 EXPLAIN 的工具的示例。

于 2013-10-20T21:57:55.637 回答