Reputation: 1203
I have a table T1
Fruit | Quantity
----------------
Apple | 2
Grape | 3
I have table T2
Factor
------
2
I want final result
Fruit | Quantity
----------------
Apple | 4
Grape | 6
A little confused how to do an update since my second table doesn't have any id's I can join on. I am using RedShift.
Upvotes: 0
Views: 817
Reputation: 48177
UPDATE T1
SET Quantity = Quantity * T2.factor
FROM T2
-- optional
WHERE T1.id = T2.id
see working sqlFiddle
Upvotes: 0
Reputation: 204746
select t1.fruit, t1.quantity * t2.factor
from t1
cross join t2
Upvotes: 1