How do I save a result of a calculated select in a column? I want to save(write it) the result of that multiplication in a column of table one like table1.total
SELECT table1.quantity * table2.price AS result FROM table1 LEFT JOIN table2 ON table1.code = table2.code
Advertisement
Answer
I think you just mean this:
UPDATE table1 SET total = table1.quantity * table2.price FROM table1 LEFT JOIN table2 ON table1.code = table2.code
See example here