与over函数结合的几个函数介绍
来源:互联网 发布:主题商店软件下载 编辑:程序博客网 时间:2024/06/09 14:27
--sum()over()的使用
select name,class,s, sum(s)over(partition by class order by s desc) mm from t2 --根据班级进行分数求和
dss 1 95 190 --由于两个95都是第一名,所以累加时是两个第一名的相加
ffd 1 95 190
fda 1 80 270 --第一名加上第二名的
gds 2 92 92
cfe 2 74 166
gf 3 99 198
ddd 3 99 198
3dd 3 78 276
asdf 3 55 331
select name,class,s, sum(s)over(partition by class order by s desc) mm from t2 --根据班级进行分数求和
dss 1 95 190 --由于两个95都是第一名,所以累加时是两个第一名的相加
ffd 1 95 190
fda 1 80 270 --第一名加上第二名的
gds 2 92 92
cfe 2 74 166
gf 3 99 198
ddd 3 99 198
3dd 3 78 276
asdf 3 55 331
adf 3 45 376
--ratio_to_report(a)函数用法 Ratio_to_report() 括号中就是分子,over() 括号中就是分母
with a as (select 1 a from dual
union all
select 1 a from dual
union all
select 1 a from dual
union all
select 2 a from dual
union all
select 3 a from dual
union all
select 4 a from dual
union all
select 4 a from dual
union all
select 5 a from dual
)
select a, ratio_to_report(a)over(partition by a) b from a
order by a;
- 与over函数结合的几个函数介绍
- 与over函数结合的几个函数介绍
- OVER(PARTITION_BY)函数介绍.
- OVER函数介绍
- SQL SERVER中OVER子句与聚集函数的结合使用
- sql中over函数介绍
- oracle over() 开窗函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- OVER(PARTITION BY)函数介绍
- 存储卡的相关标准.CF.SD.SDHC.MMC.TF
- 两道与移动开发相关的英文设计模式题
- 6.00 Introduction to Computer Science and Programming lec3 & lec4
- jsp中application/msword 下载的是jsp文件不是word
- http协议常用操作方法使用场景
- 与over函数结合的几个函数介绍
- 查询在一张表不在另外一张表的记录
- C++函数重载无聊
- 修改SMDK6410的调试串口为普通串口(wince系统)
- Windows Mobile下播放PCM音频的双缓冲用法
- wave 采集总结
- css伪类
- 音频传输心得
- 打开声音设备需要使用waveOutOpen函数