:::: 개발 ::::/::: MSSQL :::

금액 단위 변환

nayha 2009. 12. 28. 14:13
   SELECT
    
    CASE
    WHEN left(gen.paytype,1) = '일' AND cast(gen.j_pay as int) > 10000 THEN left(gen.paytype,1) + left(gen.j_pay,LEN(gen.j_pay)-4) + '만'
    WHEN left(gen.paytype,1) = '연' AND cast(gen.j_pay as int) > 10000  THEN left(gen.paytype,1) + left(gen.j_pay,LEN(gen.j_pay)-4) + '만'
    WHEN left(gen.paytype,1) = '주' AND cast(gen.j_pay as int) > 10000  THEN left(gen.paytype,1) + left(gen.j_pay,LEN(gen.j_pay)-4) + '만'
    WHEN left(gen.paytype,1) = '시' THEN left(gen.paytype,1) + gen.j_pay
    WHEN left(gen.paytype,1) = '월' AND cast(gen.j_pay as int) > 10000  THEN left(gen.paytype,1) + left(gen.j_pay,LEN(gen.j_pay)-4) + '만'
    WHEN left(gen.paytype,1) = '협' THEN '급여협의'
    ELSE left(gen.paytype,1) + gen.j_pay + '원' 
    --left(gen.paytype,1) +gen.j_pay + '원'
    END
   FROM ( select paytype='시' , j_pay='19200') AS gen
반응형