sql 使用另一个 table 中的结果更新列值

sql update column value using result in another table

我有一个table T1

Fruit | Quantity
----------------
Apple | 2
Grape | 3

我有table T2

Factor
------
  2

我要最终结果

Fruit | Quantity
----------------
Apple | 4
Grape | 6

有点困惑如何进行更新,因为我的第二个 table 没有任何我可以加入的 ID。 我正在使用 RedShift。

select t1.fruit, t1.quantity * t2.factor
from t1
cross join t2
UPDATE T1
SET Quantity = Quantity * T2.factor
FROM T2

-- optional
WHERE T1.id = T2.id

看工作sqlFiddle