查出一个表中字段值出现次数大于2的所有记录
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 13:11 点击:次
表web_order 列 name ,businesscode, a.account
周桥 18929609222 3754031157710000
妙药 18929609233 3754031157712344
灵丹 18929609189 3754031157710000
周桥 13329609189 3754031157713333
查出一个表中account 出现次数大于2的所有记录
select a.name ,a.businesscode, a.account
from web_order a,
(select b.account,count(b.account) as count
from web_order b
group by b.account
having count(b.count)>300
) c
where a.account=c.account
不重复显示name,bsinesscode,account 并加一列count(account)
select min(a.name) ,min(a.businesscode),a.account, count(a.account)
from web_order a where 1=1
group by a.account
having count( a.account)>=100
作者“he-zhengxing”
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>