Multiply two columns in a select

1

I have two columns ( valor_unitario and quantidade ) I wanted to make a select that multiplied all the columns of the valor_unitario * quantidade field.

Example:

Valor_Unit|Quantidade
    15    *    2
          +
    10    *    1

Result: 40

    
asked by anonymous 17.05.2018 / 15:35

1 answer

0

Basically it is only necessary to make a SUM on top of its column multiplication:

SELECT SUM((Valor_Unit * Quantidade)) AS total
  FROM tabela
    
17.05.2018 / 15:40