having count group by

时间:2021-05-27 15:38:24

select count(*) from (select field2,count(field2) from bsgj.table1  group by field,items_id having(count(field2)>1)) as tmp

where field2=4

3月份以来下单超过两单的收货人手机号
 
SELECT t1.ship_mobile FROM orders as t1  
where from_unixtime(t1.createtime)>'2015-03-01 00:00:00' 
and t1.pay_status in ('1','4','5')
group by t1.member_id having(count(t1.member_id)>2) order by t1.order_id desc