mysql中having与group的使用

1、查询中的having。
案例:
select goods_id,goods_name,market_price - shop_price as discount from goods where 1 having discount>200;
mysql中having与group的使用_第1张图片
2、having与group综合运用
Ecshop中(having与group by同时使用)
查询模型: select 列变量,结果列变量 as K from 表名 group by 表的列变量 having 判断语句。
案例:
select cat_id,sum(goods_number*shop_price) as K from goods group by cat_id having K>20000;
mysql中having与group的使用_第2张图片

你可能感兴趣的:(Ecshop2.7.3版本安装,mysql,ECShop)