由一组 Row 导出的 SQL 值

问题描述

嗨,我的桌子看起来像这样

1

具有相同 S id 的行的组合称为一个族。 输出应具有基于以下推导的计算层代码

输出放应该是 Output

我第一次使用 Stackoverflow。我需要在 db2 中进行查询,我可以将输出用作报告。

解决方法

你需要的windows函数如下:

Select t.*,Concat('Tier ',count(*) over (partition by s_id) ) as tier
  From your_table t

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...