clear markdown compare help donate comments/suggestions/bugs a leap of faith? diddy dollings
clear markdown donate comments/suggestions/bugs a leap of faith?
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 432196 distinct fiddles created so far.

CREATE TABLE CTE ([商品貨號] int, [安全量] int, [基本撥量] int) ; INSERT INTO CTE ([商品貨號], [安全量], [基本撥量]) VALUES (0011092, 48, 4), (001103, 36, 3), (0015584, 16, 3) ; select [商品貨號], [安全量], [基本撥量], [安全量]/2 基本安全撥數, ([安全量]/2) % [基本撥量] MOD結果, case when ([安全量]/2) % [基本撥量] = 0 then [安全量] else [基本撥量] * (([安全量]/2)/[基本撥量]+1) end [新基本撥量] from CTE; select [商品貨號], [安全量] [原安全量], [基本撥量], case when ([安全量]/2) % [基本撥量] = 0 then [安全量]/2 else [基本撥量] * (([安全量]/2)/[基本撥量]+1) end [新安全量] from CTE
商品貨號 安全量 基本撥量 基本安全撥數 MOD結果 新基本撥量
11092 48 4 24 0 48
1103 36 3 18 0 36
15584 16 3 8 2 9
商品貨號 原安全量 基本撥量 新安全量
11092 48 4 24
1103 36 3 18
15584 16 3 9
 hidden batch(es)