设为首页 加入收藏

TOP

count(distinct xxx)与distinct
2014-11-24 01:22:02 来源: 作者: 【 】 浏览:5
Tags:count distinct xxx
count(distinct xxx)与distinct
select a,b,c
select a,b,distinct c 不对 distinct必须是对所有字段排重,必须写在外面。
select distinct a,b,c
第二种 也叫转置 主要理解意思
select a,count(distinct b) ....group by a
按照a,汇总不同的b。
1 1
1 2
1 3
1 2
汇总后:
1 3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇sql count不重复的记录个数 下一篇procedure emp_count

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: