0

给定下表:

Table1
| id | intermediate_id |

Itermediate
| id |

Table2
| id | intermediate_id | table1_id|

如何使用 Table1.ids 更新 Table2?

我正在尝试以下操作:

update Table2
set table1_id = 
(select table1.id 
 from table1
 where table1.intermediate_id = table2.intermediate_id);

这给了我“错误:用作表达式的子查询返回的不止一行”

4

1 回答 1

1
update Table2
set table1_id = table1.id
  from table1
  where table1.intermediate_id = table2.intermediate_id
于 2012-11-06T11:57:36.807 回答