반응형
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
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
반응형
':::: 개발 :::: > ::: MSSQL :::' 카테고리의 다른 글
[본문스크랩] nolock 잠금힌트 (0) | 2009.12.28 |
---|---|
[본문스크랩] SET NOCOUNT ON (0) | 2009.12.28 |
[본문스크랩] sql2005 Express 설치 및 adventureworks 설치 (0) | 2009.12.28 |
간단 JOIN 개념잡기 (0) | 2009.12.28 |
루프돌려 데이타 넣기 (0) | 2009.12.28 |
복제 되는 테이블에 컬럼추가 sp ~~ (0) | 2009.12.28 |
속도 비교 (이벤트 응모자 날짜별 뽑기) (0) | 2009.12.28 |
스칼라 함수 >> 여러 row 한 필드로 가져오기 (0) | 2009.12.28 |