当前位置: 首页 > news >正文

自媒体网站开发c mvc网站开发实例教程

自媒体网站开发,c mvc网站开发实例教程,做政协网站软件的公司,永久免费的网站推荐文章目录 1、源数据2、生成数组2.1 groupArray 分组合并为数组2.2 arrayEnumerate 标记数据 3、rank()、row_number()3.1 说明3.2 使用 目前应用很多需求设计对数据分组并去特定数量的数据#xff1b; clickhouse 新版本增加了row_number()#xff0c;rank() 函数#xff0c… 文章目录 1、源数据2、生成数组2.1 groupArray 分组合并为数组2.2 arrayEnumerate 标记数据 3、rank()、row_number()3.1 说明3.2 使用 目前应用很多需求设计对数据分组并去特定数量的数据 clickhouse 新版本增加了row_number()rank() 函数可以直接对分组数据添加行号下面是记录了这两个函数的基本使用另外用 groupArray方式也大概实现了添加行号(官网上有说 groupArrayLast 可以实现自动排序的功能)但是实测这函数没法使用所以暂不记录 1、源数据 select a as name, 25 as age,165 as height union all select b as name, 21 as age,182 as height union all select a as name, 21 as age,187 as height union all select a as name, 25 as age,158 as height union all select b as name, 22 as age,168 as height2、生成数组 2.1 groupArray 分组合并为数组 groupArray 会把同类型的值合并为数组并过滤NULL值数据格式groupArray(max_size)(fields) -- 不限制分组数量 select name,groupArray(age) from (select a as name, 25 as age,165 as height union all select b as name, 21 as age,182 as height union all select a as name, 21 as age,187 as height union all select a as name, 25 as age,158 as height union all select b as name, 22 as age,168 as height ) a group by name;namegroupArray(age)b[21,22]a[25,21,25] -- 限制分组数量为1 -- 如果先对内部数据排序再分组可拿取age最大的一条 -- arrayStringConcat 将数据用特定字符合并 select name,groupArray(1)(age),arrayStringConcat(groupArray(1)(age),) from (select * from (select a as name, 25 as age,165 as height union all select b as name, 21 as age,182 as height union all select a as name, 21 as age,187 as height union all select a as name, 25 as age,158 as height union all select b as name, 22 as age,168 as height) a order by age desc ) r group by name;namegroupArray(1)(age)arrayStringConcat(groupArray(1)(age),‘’)b[22]22a[25]25 2.2 arrayEnumerate 标记数据 select name,groupArray(age) as values,arrayEnumerate(values) as indexs from (select a as name, 25 as age,165 as height union all select b as name, 21 as age,182 as height union all select a as name, 21 as age,187 as height union all select a as name, 25 as age,158 as height union all select b as name, 22 as age,168 as height ) a group by name;namevaluesindexsb[21,22][1,2]a[25,21,25][1,2,3] 3、rank()、row_number() 3.1 说明 https://clickhouse.com/docs/en/sql-reference/window-functions 3.2 使用 --rank() select name,age,rank() over(partition by name order by age asc ) from (select a as name, 25 as age,165 as height union all select b as name, 21 as age,182 as height union all select a as name, 21 as age,187 as height union all select a as name, 25 as age,158 as height union all select b as name, 22 as age,168 as height ) a group by name,age;-- row_number() select name,age,row_number() over(partition by name order by age asc ) from (select a as name, 25 as age,165 as height union all select b as name, 21 as age,182 as height union all select a as name, 21 as age,187 as height union all select a as name, 25 as age,158 as height union all select b as name, 22 as age,168 as height ) a group by name,age;nameagerank() OVER (PARTITION BY name ORDER BY age ASC)a211a252b211b222 PS. 行号已经标明后续需要取多少数据设置行号条件即可
http://www.pierceye.com/news/426856/

相关文章:

  • 青海西宁制作网站企业做网站用什么语言编写
  • 网站变成手机网站做简历的网站都有哪些内容
  • 汽车网站建设页面软件公司都是帮别人做网站么
  • 微信的企业网站模板深圳做关键词优化平台
  • 用什么框架做网站快网站建设与维护薪资
  • 深圳公明做网站用织梦做网站都需要用什么
  • 广西城乡建设部网站首页国家住房和城乡建设部中国建造师网站
  • 杭州高端网站设计公司天津做网站那家好
  • 怎么建立网站?长沙做网站价格
  • 新网网站后台登陆程序员为什么35岁就不能干?
  • 百度申诉网站seo项目经理
  • 北京网站排名优化软件花箱 东莞网站建设
  • wordpress 迁站如何来建设网站
  • 营销型企业网站建设哪家好自己个人网站后台怎么做
  • 如何做网站内链优化网店运营的工作内容
  • 邢台网站设计cute wordpress主题破解版
  • 建站网站案例什么在线做动图的网站比较好
  • 云南做网站哪家便宜对象存储链接WordPress
  • 网站上传模板后ui设计界面配色
  • 阿里网站备案公众号小程序制作平台
  • 东莞网站建设seo公司为什么建立网站
  • 一个网站绑定多个域名可以做logo设计单子的网站
  • 哈尔滨市建设厅网站去国外做非法网站吗
  • 淮安网站建设要多少钱营销推广网歹
  • 洛阳建设企业网站成品app直播源码推荐
  • 网站值不值得做seo什么事三合一网站
  • 微网站开发协议中国建设部网站监理延续
  • 安阳网站建设公司wordpress评论模块
  • 做服装微商城网站wordpress后台载入慢
  • 免费3d模型素材网站免费发布房源的平台