select
AM_CLAIM_E --청구액
,AM_DEPOT_E --입금액
from SA_TABLE
where case
@aaa = '1' then AM_DEPOT_E = 0 --미입금
@aaa = '2' then AM_DEPOT_E < AM_CLAIM_E --입금중
@aaa = '3' then AM_DEPOT_E >= AM_CLAIM_E --입금완료
end
@aaa이라는 변수는 1,2,3으로 들어옵니다.
Comment 2
-
향지
2016.07.19 11:23
-
가경승민아빠
2016.07.19 13:48
select * from (
select
AM_CLAIM_E --청구액
,AM_DEPOT_E --입금액
, casewhen @aaa = '1' and AM_DEPOT_E = 0 then '미입금'
when @aaa = '2' and AM_DEPOT_E < AM_CLAIM_E then '입금중'
when @aaa = '3' and AM_DEPOT_E >= AM_CLAIM_E then '입금완료'
end as '입급상태'
from SA_TABLE
)TAA
where TAA.입금상태 = '입금완료'
@aaa 값에 따라서
IF문으로 나눠서 select 하시면 안될까요?