码迷,mamicode.com
首页 > 其他好文 > 详细

having count group by

时间:2015-08-17 16:54:57      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:

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

having count group by

标签:

原文地址:http://www.cnblogs.com/walter371/p/4736998.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!