Multiply two columns in a select

Asked

Viewed 5,598 times

1

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

Example:

Valor_Unit|Quantidade
    15    *    2
          +
    10    *    1

Result: 40

1 answer

1


Basically it is only necessary to perform a SUM upon their multiplication of the columns:

SELECT SUM((Valor_Unit * Quantidade)) AS total
  FROM tabela

Browser other questions tagged

You are not signed in. Login or sign up in order to post.