0

I have a table materiel that contains four columns(id, nom, quantity, price, amount).

I want to know how to affect the result of column amount.

knowing that : amount = price * quantity

I tried with : SELECT (price * quantity) AS res FROM materiel

But I would affect the result in the amount column

  • Are there four (as mentioned) or five (as listed) columns? Asked differently, is the amount column already part of the DB schema? – Paul Apr 26 '16 at 08:29
  • 1
    http://stackoverflow.com/questions/5693259/how-can-a-query-multiply-2-cell-for-each-row-mysql – Adersh Apr 26 '16 at 08:29
  • yes column amount is already part of the table materiel – martin olsson Apr 26 '16 at 08:31
  • Do this Update material set amount=price* quantity – Mukesh Kalgude Apr 26 '16 at 08:36
  • As you have mentioned, > I want to know how to affect the result of column amount. knowing that : amount = price * quantity I understand that you want to update the value of amount as price * quantity. Am I correct in assuming that? If yes, then: If you want to do a single update then: update materiel set amount = price * quantity; – MontyPython Apr 26 '16 at 08:42

0 Answers0