MySQL 聚合函数

  sre
只有一个返回值
AVG() - 平均值
SELECT ROUND(AVG(goods_price),2) AS avg_price FROM tdb_goods;
COUNT() - 计数
SELECT COUNT(goods_id) as counts FROM tdb_goods;
MAX() - 最大值
SELECT MAX(goods_price) as counts FROM tdb_goods;
MIN() - 最小值
SUM() - 求和
SELECT SUM(goods_price) as counts FROM tdb_goods;

LEAVE A COMMENT

Captcha Code