码迷,mamicode.com
首页 > 数据库 > 详细

Mysql count(1) group_concat 高级用法(count 过滤条件,group_concat过滤条件)

时间:2018-07-20 14:00:13      阅读:2252      评论:0      收藏:0      [点我收藏+]

标签:条件   order by   fun   integer   name   color   mysq   int   ble   

1、官方文档:

     count:COUNT(expr) [over_clause]

              https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html#function_count

1.1 实例:

    



select update_time,sid,group_concat(if(age > ‘1‘, tid, NULL)),count(DISTINCT if(age =1,tid,null)) as current_t

from tb_s_members group by update_time,sid order by update_time desc

 

 

2、group_concat 官方文档:

   

GROUP_CONCAT([DISTINCT] expr [,expr ...]
             [ORDER BY {unsigned_integer | col_name | expr}
                 [ASC | DESC] [,col_name ...]]
             [SEPARATOR str_val])

https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html#function_group-concat

 

Mysql count(1) group_concat 高级用法(count 过滤条件,group_concat过滤条件)

标签:条件   order by   fun   integer   name   color   mysq   int   ble   

原文地址:https://www.cnblogs.com/cbugs/p/9340751.html

(1)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!