나올 듯 하면서도 자꾸 막히네요.
한 개 조건만 다른 상황에서 update문을 union으로 사용할 수 있을까요.?
질의 쿼리는 아래와 같습니다.
update school a
set a.FLAG = 'Y'
where 1=1
and a.type in ('1','3')
and exists (
select 'X'
from student b
where b.app_id = 1
and b.code = 'junior'
and b.source_id = a.id
)
union
update school a
set a.FLAG = 'Y'
where 1=1
and a.type not in ('1','3')
and exists (
select 'X'
from student b
where b.app_id = 1
and b.code = 'senior'
and b.source_id = a.id
)
도움 좀 부탁드려요.. T_T)