求和方法:Sum API-Medoo使用指南

上一篇《平均值方法:Avg API-Medoo使用指南》介紹了Medoo的Avg方法取得平均值,接下來要介紹的就是求和的方法,經過Sum方法來獲得各列的和。php


求和方法:Sum API,獲取列的總和。html

sum($table, $column, $where)
//table [string]: 表名
//column [string]: 將要被計算的目標列
//where (可選)[array]:WHERE子句篩選記錄


返回值: [number]:各列的總和。post

提示:返回值的數據類型是數字。
spa


$database = new medoo("my_database");
 
$total = $database->sum("account", "money");
 
echo "We have $" . $total;

到此,Medoo查詢部分的API就介紹完了。後面咱們將開始介紹高級API。.net


Medoo版本: 0.9.1.1 code

原文標題: 求和方法:Sum API-Medoo使用指南htm

原文連接: http://loiy.net/post/619.htmlget

相關文章
相關標籤/搜索