Shakti Singh
Shakti Singh

Reputation: 86346

get the sum of a column in all rows mysql

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 rows.

   order_id grand_total 
   1         10
   2         20

query should output 30

Thanks

Upvotes: 5

Views: 7382

Answers (1)

Demitrius Nelon
Demitrius Nelon

Reputation: 1248

SELECT SUM(grand_total) FROM order

Here is a reference to aggregate functions in MYSQL.

Upvotes: 8

Related Questions