Home  >  Article  >  Database  >  sql如何去除重复数据

sql如何去除重复数据

WBOY
WBOYOriginal
2016-06-07 17:46:591717browse

sql如何去除重复数据,

很多朋友一听就会想到DISTINCT ,那我们来看看distinct的用法吧.

下面来看看语法:

SELECT DISTINCT column_name(s)FROM table_name
下面看个简单的例子:
<pre class="brush:php;toolbar:false">SELECT DISTINCT City FROM Persons
 
好了下面我们再来看看另一种方法用group by 来做吧,这个想法是从网上来的下面我们来看看下面的sql.
 
Select *,m_id from tbname group by m_id order by w_support desc
 
本站原创:转载注明
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn