开发者

get the sum of a column in all rows mysql

开发者 https://www.devze.com 2023-02-02 03:27 出处:网络
I have a order table and I want to get the total sale till now. This table contain the columngrand_total. I want to get the sum of this column from all row开发者_开发知识库s.

I have a order table and I want to get the total sale till now. This table contain the column grand_total. I want to get the sum of this column from all row开发者_开发知识库s.

   order_id grand_total 
   1         10
   2         20

query should output 30

Thanks


SELECT SUM(grand_total) FROM order

Here is a reference to aggregate functions in MYSQL.

0

精彩评论

暂无评论...
验证码 换一张
取 消