Get column sum in all mysql rows

I have a table order, and I want to get a total sale so far. This table contains a column grand_total. I want to get the sum of this column from all rows.

   order_id grand_total 
   1         10
   2         20

request should output 30

thank

+3
source share
1 answer
SELECT SUM(grand_total) FROM order

Here is a link for aggregating functions in MYSQL.

+4
source

Source: https://habr.com/ru/post/1782601/


All Articles