首页 > 代码库 > 查询一个值出现的次数大于num,并统计次数,

查询一个值出现的次数大于num,并统计次数,

SELECT COUNT( 要统计次数的字段) FROM 表 GROUP BY 要统计字段 HAVING COUNT(要统计字段) > num

查询下单次数超过50次商品

SELECT goods_id, goods_name,COUNT(goods_id) FROM tp_order_goods GROUP BY goods_id HAVING COUNT(goods_id) > 50

查询一个值出现的次数大于num,并统计次数,