1 2 3 4 5 | SELECT B.WMS_CLHADT, B.WMS_CLHA_CLASS, C.ORDER_STATUS FROM EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B, EM_ORDER_GOODS_TEST C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | UPDATE EM_ORDER_GOODS_TEST SET ORDER_STATUS = '77' WHERE ORD_NUM IN ( SELECT A.ORD_NUM FROM EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B, EM_ORDER_GOODS_TEST C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ) AND GOODS_ID IN ( SELECT A.GOODS_ID FROM EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B, EM_ORDER_GOODS_TEST C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ) AND ORD_DEAL_SEQ IN ( SELECT A.ORD_DEAL_SEQ FROM EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B, EM_ORDER_GOODS_TEST C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ) 요렇게하니까 968건이 업데이트되네요 ㅠㅠ 뭔가잘못하고있는거죠.. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 맨위 질의 올려주신 SELECT B.WMS_CLHADT, B.WMS_CLHA_CLASS, C.ORDER_STATUS FROM EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B, EM_ORDER_GOODS_TEST C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) 요게 967건 뜬고 업데이트 967건 되어야 한다면. 일단 C는 다음과 같이 하시면 될거 같습니다. update EM_ORDER_GOODS_TEST c set ORDER_STATUS = '10' where exists( select 1 from EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B where B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ); <br><br>B는 말씀주신 것처럼 바꿔쓰시면 될거 같아용. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | update EM_ORDER_GOODS_TEST c set ORDER_STATUS = '99' where exists( select 1 from EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B where B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ); |
1 2 3 4 5 6 7 8 9 10 11 | update EM_ORDER_GOODS_TEST c set ORDER_STATUS = '57' where exists( SELECT 1 FROM EM_HMNW_RECIPT_HIS_TEST A, EM_ORDER_DETAIL_TEST B, EM_ORDER_GOODS_TEST C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | -- ORDER_STATUS = '' 업데이트 쿼리 UPDATE EM_ORDER_GOODS SET ORDER_STATUS = '18' WHERE 1=1 AND (ORD_NUM, GOODS_ID, ORD_DEAL_SEQ) IN ( SELECT C.ORD_NUM, C.GOODS_ID, C.ORD_DEAL_SEQ FROM EM_HMNW_RECIPT_HIS A, EM_ORDER_DETAIL B, EM_ORDER_GOODS C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ) -- WMS_CLHA_CLASS = '', WMS_CLHADT = '' 업데이트쿼리 UPDATE EM_ORDER_DETAIL SET WMS_CLHA_CLASS = '' , WMS_CLHADT = '' WHERE 1=1 AND (ORD_NUM, GOODS_ID, GOODS_SEQNO) IN ( SELECT C.ORD_NUM, C.GOODS_ID, C.ORD_DEAL_SEQ FROM EM_HMNW_RECIPT_HIS A, EM_ORDER_DETAIL B, EM_ORDER_GOODS C WHERE B.WMS_CLHADT = TO_DATE ( '20130902' , 'YYYYMMDD' ) AND (A.ORD_NUM = B.ORD_NUM AND A.GOODS_ID = B.GOODS_ID AND A.ORD_DEAL_SEQ = B.GOODS_SEQNO) AND (A.ORD_NUM = C.ORD_NUM AND A.GOODS_ID = C.GOODS_ID AND A.ORD_DEAL_SEQ = C.ORD_DEAL_SEQ) ) 이렇게 해결하였습니다. 매우매우 감사합니다. 그런데 마농님께서 인덱스 만들라구 하셧는데 인덱스 무었인가요? 테이블 인덱스 만들기로 검색해도 안나와서 질문드립니다(__) |