[YOGOJOGO]
[mybatis] case when than 사용법
재래김유진
2020. 10. 7. 12:16
728x90
반응형
select case when block_yn = 'Y' then '차단' when drop_yn = 'Y' then '탈퇴' when block_yn ='N' and drop_yn ='N' then '정상' end as status from svc_user; |
지금 사용하고 있는 postgre에서는 이렇게해도 문제없이 잘 돌아간다.
하지만 저 쿼리를 mybatis에서 사용하려고 하면 ()로 묶어줘야한다
like this,,
select , user_no , (case when block_yn = 'Y' then '차단' when drop_yn = 'Y' then '탈퇴' when block_yn ='N' and drop_yn ='N' then '정상' end) as status , user_email from aaa_user; |
728x90
반응형