惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
G
Google Developers Blog
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
F
Full Disclosure
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
Help Net Security
Help Net Security
The Hacker News
The Hacker News
IT之家
IT之家
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
V
Visual Studio Blog
博客园 - 聂微东
Hacker News: Ask HN
Hacker News: Ask HN
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Last Week in AI
Last Week in AI
Schneier on Security
Schneier on Security
N
News and Events Feed by Topic
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
Google DeepMind News
Google DeepMind News
Cloudbric
Cloudbric
N
News | PayPal Newsroom
A
About on SuperTechFans
S
Schneier on Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
雷峰网
雷峰网
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
K
Kaspersky official blog
The Cloudflare Blog
I
Intezer

博客园 - M'

AndroidStudio修改项目名称 cocos2dx2.x&3.x部分函数对照表 Ubuntu 安装mono 关于BigDecimal.ROUND_HALF_UP与ROUND_HALF_DOWN android 常用框架 理解assign,copy,retain变strong SQLSERVER2008R2正确使用索引 除非 Windows Activation Service (WAS)和万维网发布服务(W3SVC)均处于运行状态,否则无法启动网站。目前,这两项服务均处于停止状态。 Android资源命名规范 eclipse导入Android项目后,项目的名称变为了主Activity的名称 C语言位运算详解[转] Android Message里传送的数据[转] Android---组件篇---Handler的使用(1)[转] 自定义登录后台(authentication backend)[转] Nginx配置文件详细说明[转] python 进制转换[转] MySQL一些优化[转] C# Stream 和 byte[] 之间的转换[转] DotLucene(Lucene.Net)研究[转]
MySQL 去除重复的方法
M' · 2013-01-02 · via 博客园 - M'

直接看例子

例子:

     table
   id name
   1 a
   2 b
   3 c
   4 c
   5 b

1 通过 distinct 来实现

select distinct name from table

结果:

name

a

b

c

2 通过 group_concat 配合 group by 来实现 (注意:需要mysql 4.1及以上)

select  id,group_concat(distinct name) from table group by name

结果:

id name

1 a

2 b

3 c

3 通过

select id, count(distinct name) from table group by name

结果:

id name count(distinct name)

1 a 1

2 b 1

3 b 1

整理自:http://www.cnblogs.com/daiye/archive/2009/11/10/1599977.html