MySQL Select sum


Calculate Sum

The SELECT SUM() FROM syntax is used to sum the statistics from the data table.

grammar:

SELECT SUM(column) FROM Tb_name

The SQL syntax is used to count the sum of the values ​​of a numeric type field. SUM() can not be multiple fields, but types such as strings can be executed without meaning.

example:

age
1
3
5
7
9
SELECT SUM(age) FROM user 
Result
25



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook