_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 螳襦郁豺一

.. 螳襷 貉るる一 譬 襭螳 殊.
覓語.. http://www.sqler.com/264055#11

**************************************************************************************
螳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]
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53Anonymous