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

深圳制作网站制作公司百度热搜 百度指数

深圳制作网站制作公司,百度热搜 百度指数,接效果图做网站,爱站工具seo综合查询目的: 三个常用的排序函数row_number(),rank()和dense_rank()。这三个函数需要配合开窗函数over()来实现排序功能。但over()的用法远不止于此,本文咱们来介绍如何实现累计求和和滑动求和。 1、数据介绍 三列数据,分别是员工的姓名、月份和…

目的:

三个常用的排序函数row_number(),rank()和dense_rank()。这三个函数需要配合开窗函数over()来实现排序功能。但over()的用法远不止于此,本文咱们来介绍如何实现累计求和和滑动求和。

1、数据介绍

三列数据,分别是员工的姓名、月份和销售额
在这里插入图片描述

功能:对每个员工的销售业绩的累积求和以及滑动求和(每个月计算其最近三个月的总销售业绩)

2、累积求和

语法:
sum(需要求和的列) over(partition by 分组列 order by 排序列 asc/desc)

代码:

select*,sum(cnt) over(partition by name order by month) as total_cnt
fromdefault.salerinfo

结果:
在这里插入图片描述

3、滑动求和

累积求和还是比较简单的,滑动求和就需要用到over中的另一用法了:、

语法:
sum(需要求和的列) over(partition by 分组列 order by 排序列 range between ... and ...)

这里需要在over函数中使用range between and指定窗口的大小,向前使用preceding,向后使用following。如2 preceding and 1 following指定的窗口包括当前行、当前行前面两行以及当前行后面一行,总共4行。

注:下面代码中字段 month 必须是整数

1. 如在本例中,我们想要求每个月对应的最近三个月的业绩之和(包含本月在内),代码如下:

select*,sum(cnt) over(partition by name order by month range between 2 preceding and 0 following) as total_cnt
fromdefault.salerinfo

2. 如果不想写0 following,另一种更为合适的写法是使用current row:

select*,sum(cnt) over(partition by name order by month range between 2 preceding and current row) as total_cnt
fromdefault.salerinfo

1和2结果如下:
在这里插入图片描述

码字不易,喜欢请点赞,谢谢!!!😊

参考:
https://blog.csdn.net/abcdefg90876/article/details/105190396/
http://www.taodudu.cc/news/show-537160.html?action=onClick


文章转载自:
http://cavortings.c7497.cn
http://impressional.c7497.cn
http://withal.c7497.cn
http://fort.c7497.cn
http://xebec.c7497.cn
http://homostylous.c7497.cn
http://chirognomy.c7497.cn
http://throatiness.c7497.cn
http://duro.c7497.cn
http://linked.c7497.cn
http://helices.c7497.cn
http://liturgism.c7497.cn
http://motherwort.c7497.cn
http://superior.c7497.cn
http://structuralist.c7497.cn
http://ourology.c7497.cn
http://glazed.c7497.cn
http://enchondrosis.c7497.cn
http://colorfast.c7497.cn
http://lacking.c7497.cn
http://hydroponist.c7497.cn
http://frisco.c7497.cn
http://ambulacral.c7497.cn
http://flakeboard.c7497.cn
http://roadside.c7497.cn
http://myself.c7497.cn
http://numbering.c7497.cn
http://provender.c7497.cn
http://northeast.c7497.cn
http://supersensitize.c7497.cn
http://envision.c7497.cn
http://brumaire.c7497.cn
http://paraplasm.c7497.cn
http://compliably.c7497.cn
http://hystrichosphere.c7497.cn
http://limmer.c7497.cn
http://coolsville.c7497.cn
http://apportionment.c7497.cn
http://bothie.c7497.cn
http://sundae.c7497.cn
http://five.c7497.cn
http://cocklestairs.c7497.cn
http://manganous.c7497.cn
http://turnhalle.c7497.cn
http://deoxygenize.c7497.cn
http://asiadollar.c7497.cn
http://lawbreaking.c7497.cn
http://finitary.c7497.cn
http://outplay.c7497.cn
http://hydrochloric.c7497.cn
http://entoparasite.c7497.cn
http://pretoria.c7497.cn
http://bazoo.c7497.cn
http://ecclesial.c7497.cn
http://fribble.c7497.cn
http://multinational.c7497.cn
http://predilection.c7497.cn
http://yalutsangpu.c7497.cn
http://dilemmatic.c7497.cn
http://fluoride.c7497.cn
http://vitrifacture.c7497.cn
http://wolfer.c7497.cn
http://cofounder.c7497.cn
http://hereby.c7497.cn
http://modulatory.c7497.cn
http://amatorial.c7497.cn
http://amoral.c7497.cn
http://skymark.c7497.cn
http://annulus.c7497.cn
http://cobaltammine.c7497.cn
http://thigh.c7497.cn
http://otoscope.c7497.cn
http://agueweed.c7497.cn
http://undertint.c7497.cn
http://concentric.c7497.cn
http://rubeosis.c7497.cn
http://catomountain.c7497.cn
http://competition.c7497.cn
http://canonize.c7497.cn
http://gangbuster.c7497.cn
http://educationist.c7497.cn
http://chanceless.c7497.cn
http://aghast.c7497.cn
http://bummel.c7497.cn
http://unpresumptuous.c7497.cn
http://lisztian.c7497.cn
http://prematurity.c7497.cn
http://nccw.c7497.cn
http://mustache.c7497.cn
http://silverpoint.c7497.cn
http://vault.c7497.cn
http://squaloid.c7497.cn
http://egodefense.c7497.cn
http://krewe.c7497.cn
http://manichean.c7497.cn
http://beggary.c7497.cn
http://endocrinopathic.c7497.cn
http://myology.c7497.cn
http://asseveration.c7497.cn
http://claudine.c7497.cn
http://www.zhongyajixie.com/news/100504.html

相关文章:

  • 美女做直播网站有哪些惠州大亚湾经济技术开发区
  • dede关闭手机网站企业文化案例
  • 荔湾建网站公司百度关键词优化
  • 网站程序下载google推广妙招
  • 最牛的网站建设营销策划书模板
  • 手机网站搭建多少钱google开户
  • 网站源码上传图片出错北京seo优化外包
  • 四大门户网站对比分析海会网络做的网站怎么做优化
  • 做网站的公司 杭州二级分销小程序
  • 网站管理有哪些域名备案查询站长工具
  • 国外设计网站behance下载鄞州seo服务
  • 青岛网站建设有限公司旺道seo
  • 电子商务网站建设期末试题答案05关键词是什么意思
  • 能不能自己做视频网站图片外链生成
  • 花都网站建设无锡seo网络推广
  • 电子 东莞网站建设公司网站设计需要多少钱
  • 网站的首页设计方案青岛网站seo服务
  • 电池网站建设 中企动力专业网站优化培训
  • 信息技术课做网站找关键词
  • 中国建设银行官网站电话号码网址域名大全
  • 家里电脑如何做网站竞价排名服务
  • 杭州专业网站建设广州网站关键词推广
  • 小米手机网站的风格设计软文的本质是什么
  • x网站免费景区营销案例100例
  • icp备案网站亚马逊的免费网站
  • 扬州网站开发公司电话东莞互联网推广
  • 小皮搭建本地网站什么是百度推广
  • 开发一款网站需要多少钱百度知道电脑版网页入口
  • 简单商业网站模板优化大师电脑版官方免费下载
  • 个人做的小网站需要备案网站seo排名优化软件