In creating my table I want a column in D table to be a sum of two columns from two different tables. How do I do it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In creating my table I want a column in D table to be a sum of two columns from two different tables. How do I do it.

I feel it's a trigger but how do I implement due aggregate functions and reference do tables

12th Jul 2017, 5:21 PM
akachukwu
akachukwu - avatar
1 Answer
0
If you want the sum to happen for every record insert into the other two tables, then you definitely a trigger. Otherwise, if it is a one time operation, then write: insert into D ( select t1.a, t2.b, t1.a + t2.b from t1, t2 where t1.col = t2.col)
15th Jul 2017, 1:50 PM
Gurpreet Singh
Gurpreet Singh - avatar