**************************************************************************************
螳1: A = EXP(LOG(A)) 讌 襦蠏語 蟯螻
螳2: LOG(A*B) = LOG(A) + LOG(B) : http://duchii.tistory.com/31
螳3: LOG(A/B) = LOG(A) - LOG(B)
蠍一螳蟲覿: (CASE WHEN 豌覯讌瑚 THEN 1 ELSE -1 END)
**************************************************************************************
ъ: SUM()
觝: 豌螳(蠍一螳) 伎語螳- 朱CASE 覓語伎豌覯讌瑚伎碁-1 螻燕. 螳 譴.
螻煙: 螳1螳2襯殊. 螳貉手LOG 襦伎碁れEXP 襦覓苦伎朱願咳企.
:螳1螻手3. 觝襴蠍一螳伎碁- 豌襴 螳 譴.
**************************************************************************************
伎Ц る 覲旧″れ...
WITH TEST
as (
select 1 idx, 600 VAL union all
select 2 idx, 30 union all
select 3 idx, 2
)
SELECT -- 600 + 30 + 2
SUM( VAL) PLUPOINT ,
-- 600 - 30 - 2
SUM((CASE WHEN IDX = 1 THEN 1 ELSE -1 END ) * ( VAL )) SUBPOINT ,
-- 600 * 30 * 2
EXP(SUM(LOG(VAL))) MULPOINT ,
-- 600 / 30 / 2
EXP(SUM((CASE WHEN IDX = 1 THEN 1 ELSE -1 END ) * LOG(( VAL) ))) DIVPOINT
FROM TEST
select
exp(log(10) + log(5)) [10 * 5]
, exp(log(10) - log(5)) [10 / 5]