mysql去重
select a.id,a.ssmz,(select count(ssmz) from shop_tourist_key b where b.ssmz=a.ssmz) as count
from shop_tourist_key a WHERE a.ssmz is not null group by a.ssmz LIMIT 0,3;
select a.id,a.ssmz,(select count(ssmz) from shop_tourist_key b where b.ssmz=a.ssmz) as count
from shop_tourist_key a where ISNULL(a.ssmz)=false group by a.ssmz order by count DESC
LIMIT 0,3;
select a.id,a.ssmz,(select count(ssmz) from shop_tourist_key b where b.ssmz=a.ssmz) as count,
count(distinct a.ssmz) from shop_tourist_key a group by a.ssmz LIMIT 0,3 ;
mysql去重的更多相关文章
- mysql去重查询表中数据
1.distinct select count(distinct CName) from teble select count(CName) from (select distinct CName f ...
- mysql 去重,跨表更新,跨表删除
一.去重 1.查询出重复的记录 CREATE TABLE push_log_full_2013_10_30_tmp SELECT * FROM `push_log_full` WHERE time B ...
- MySql 去重且指定某字段在前的排序方法
今天遇到一个棘手的数据查找并去重的问题: 情况: 1.取出数据库中的数据: 2.同一字段A,不同情况<值,如A值为:a1,a2>下取出的其他数据可能相同: 3.将2情况下的重复数据< ...
- mysql去重的最方便的两种方法
参考资料:http://blog.csdn.net/guocuifang655/article/details/3993612 方法一: 在使用mysql时,有时需要查询出某个字段不重复的记录,虽然m ...
- [mysql]去重:DISTINCT
SELECT DISTINCT name, age:去掉name字段重复的(需要先写去重的字段):如果想多个取出多个字段重复,需要用group by.
- MySQL去重案列(待更新...)
谈谈distinct 查询单个字段,没问题! SELECT DISTINCT username FROM t_user 但是我想加入id字段,这样写,报错! SELECT id, DISTINCT u ...
- 超过70亿条数据的mysql 去重
1.数据库层面: 2.业务层面:接口去重.浏览器显示端去重:
- mysql去重, 把url重复且区为空的中去掉、统计重复数据、、结果集去重合并成一行
delete from 表名 where id not in (select d.id from (SELECT id FROM 表名 GROUP BY c1,c2,c3,c4)as d) #去重复, ...
- mysql 去重的两种方式
1.distinct一般用于获取不重复字段的条数 使用原则: 1)distinct必须放在要查询字段的开头,不能放在查询字段的中间或者后面 select distinct name from user ...
随机推荐
- OSG透明代码
//关闭灯光 state->setMode(GL_LIGHTING,osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED); //打开混 ...
- 火狐min-height不兼容解决方法
我们在进行页面架构的时候,一般会分成三个section:header.body.footer.如下面这个页面: 这个时候我们就需要对body部分进行最小高度设置,才能避免footer部分出现在页面中间 ...
- nmon的安装
安装 mkdir /usr/local/nmon cd /usr/local/nmon wget http://sourceforge.net/projects/nmon/files/nmon_lin ...
- C语言SOCKET编程指南
1.介绍 Socket 编程让你沮丧吗?从man pages中很难得到有用的信息吗?你想跟上时代去编Internet相关的程序,但是为你在调用 connect() 前的bind() 的结构而不知所措? ...
- JVM相关
内存栅栏 1 what 说白了是一些cpu或编译器的一些同步指令 2 why cpu的cache快,而不去内存中取数据,在多线程并发中会读到cache的数据. 3 how 一般直接用关键字viloti ...
- Ubuntu菜鸟入门(三)—— 无用软件卸载,wps等常用软件安装
一 移除不需要的软件 sudo apt-get remove libreoffice-common sudo apt-get remove unity-webapps-common sudo apt ...
- OneThink开发框架
OneThink是一个开源的内容管理框架,基于最新的ThinkPHP3.2版本开发,提供更方便.更安全的WEB应用开发体验,采用了全新的架构设计和命名空间机制,融合了模块化.驱动化和插件化的设计理念于 ...
- GnuStep使用
gcc -o main main1.m -I/GNUstep/System/Library/Headers -fconstant-string-class=NSConstantString -L/GN ...
- Who's in the Middle[HDU1157]
Who's in the Middle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- Leetcode Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...