Home  >  Article  >  Backend Development  >  数组求和()

数组求和()

WBOY
WBOYOriginal
2016-06-13 13:15:48793browse

数组求和(求助)
表 test 有字段 CODE 和 MONEY,如何按照code将money求和

------解决方案--------------------
$sql= "select code, sum(money) as money from test group by code";

这只是sql语句。你都没有执行查询,想输出什么呢?
------解决方案--------------------
select code ,sum(money) from test group by code having code='$cc'

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn