Skip to content
Advertisement

How to sum 2 columns in a non-named table I have built from other tables

I have built a table taking columns from several other tables that are all linked by one or another common columns. I now need to perform simple multiplication on 2 the data in 2 columns contained in the table I have built. I see examples of the syntax such as this: SELECT name, price*quantity AS total_price FROM purchase;

however I don’t know what to put in here for the ‘FROM’ table as I am performing this arithmetic on 2 columns from the table I have built which to my knowledge doesn’t have a name (unless there is some sort of default name you can use for these tables we build? I am very new to SQL..).

Here is my code so far:

On my output I have 2 columns called RATE and BASIS_TYPE which I need to muliply together on a row by row basis and get the output in a new column. These 2 columns were both taken from REPLDOADM.IRE_ESTIMATE_TRANS_MAP initially.

Any thoughts?

Advertisement

Answer

I think you simply need this –

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement