안녕하세요
sybase 를 쓰고 있다가 여기 있는 update 쿼리를 변경하려고 하는 중
merge 라는 부분으로 바꾸려 하는 막히는 부분이 있어서 글을 남깁니다.
사이베이스 쿼리는 다음과 같습니다.
================================
update CUSTOMER A
set A.custid = (case when B.RO_ID is null
then case when C.SC_NUM
then 0
else 1
end
else ' '
end)
from CUSTOMER A , (select rid,num from STAFF where B.rid='1') B,(select rid,num from EMP where rid='0') C
where A.rid *=B.rid
and B.num *=C.num
and A.custid <> '0'
|