Skip to content

Instantly share code, notes, and snippets.

@yssymmt
Created April 17, 2022 14:14
Show Gist options
  • Save yssymmt/952537ffe283e0784c0a63d7b52dc69c to your computer and use it in GitHub Desktop.
Save yssymmt/952537ffe283e0784c0a63d7b52dc69c to your computer and use it in GitHub Desktop.
select 顧客番号, 年月,
(cast((売上数量) as float) - avg(売上数量) over(partition by 顧客番号)) / stddev_pop(売上数量) over(partition by 顧客番号)) as 売上数量z,
(cast((平均単価) as float) - avg(平均単価) over(partition by 顧客番号)) / stddev_pop(平均単価) over(partition by 顧客番号)) as 平均単価z
from データベース名.テーブル名
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment