mysql 过滤分组
2024-09-20 15:24:08
mysql> select * from table1;
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | lee | | -- :: |
| 3hahha | lee | | -- :: |
| 3hahha | lee | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | bob | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec) mysql> select transactor,count(*) as num from table1 where pid >= group by transactor with rollup;
+------------+-----+
| transactor | num |
+------------+-----+
| 4xiaohong | |
| bob | |
| lee | |
| NULL | |
+------------+-----+
rows in set (0.00 sec) mysql> select transactor,count(*) as num from table1 where pid >= group by transactor with rollup having num>=;
+------------+-----+
| transactor | num |
+------------+-----+
| bob | |
| lee | |
| NULL | |
+------------+-----+
rows in set (0.00 sec)
最新文章
- [转]Windows 8.1删除这台电脑中视频/文档/下载等六个文件夹的方法
- Liferay 6.2 改造系列之五:修改默认站点的页面内容
- RAC转换为RAC One Node
- 仿微信朋友圈图片查看-glide加载网络图片,photoview 实现缩放
- OpenGL的几何变换2之内观察立方体
- 判断是否含有中文,包含返回true,不包含返回false
- jQuery中的经典动画
- 基于canvas的二维码邀请函生成插件
- [Codeforces Round #516][Codeforces 1063C/1064E. Dwarves, Hats and Extrasensory Abilities]
- 页面通过Jquery取值然后传值到后台显示underfined是怎么回事?
- Tensorflow生成唐诗和歌词(下)
- cant found Microsoft.VSSDK.BuildTools.15.0.26201
- linux下gcc默认搜索的头文件及库文件路径
- java Concurrent包学习笔记(三):ReentrantLock
- [Spark Core] Spark 核心组件
- 【刷题】BZOJ 4059 [Cerc2012]Non-boring sequences
- vue refs v-for 使用注意
- Microsoft SQL SERVER 2008 R2 REPORT SERVICE 匿名登录
- 利用JDK动态代理机制实现简单拦截器
- Java的四种引用类型之弱引用