MySQL summation statement is "select sum(money) from record t where t.name = ?", where the parameter t represents the alias of a table.
The operating environment of this article: Windows 7 system, Mysql version 5.7.14, Dell G3 computer.
What is the mysql sum statement?
Example: Query the added value of money with name=? in the record table
Use polysum Function sum() summing
select sum(money) from record t where t.name = ?
Note: t is an alias of a table. For example, t.name is the name in the record table. You can also use record.name, but it is too long, so use a Aliases are more convenient
Extended information:
Aggregation functions are AVG, COUNT, MAX, MIN and SUM. The syntax of aggregate functions is described in the following example
aggregation-function ( [ ALL | DISTINCT ] expression )
or: COUNT( [ ALL | DISTINCT ] identification-variable )
or: COUNT( * )
Before applying the function, DISTINCT Option to eliminate duplicate values.
[Related recommendations: mysql video tutorial]
The above is the detailed content of What is the mysql sum statement?. For more information, please follow other related articles on the PHP Chinese website!