작동하는 사례 하위 쿼리를 만들지 만, 더 쉬운 방법이 있어야합니다.이 사례 쿼리를 만드는 더 좋은 방법이 있습니까?
쿼리의 목적은 billgrp_desc가 '30 % '인 경우 tbm.billgrp 테이블에서 billgrp_desc를 표시하는 것입니다. hbm.matter 테이블에서
그렇지 않으면 디스플레이 matter_code billgrp_desc '30 % '
쿼리를 좋아하지 다음과 같습니다 :
select
case
when bllgrp_desc like '30%' then 'billgrp_desc'
end
from tbm.billgrp
union
select
case
when exists (select billgrp_desc
from tbm.billgrp
where billgrp_desc not like '30%') then 'matter_code'
end
from hbm.matter
아마이 길 갈 것
에서 필드는 큰 쿼리의 일부만 Matter_code을이다 가정입니까? 그렇다면 전체 쿼리를 제공하는 것이 좋습니다. –