2012.07.21 09:11

[Oracle] JOIN DELETE

## 1 ##

 

DELETE 
  FROM 테이블1 A
 WHERE EXISTS
            (

 SELECT 1
   FROM 테이블2 B
 WHERE A.테이블1_키 = B.테이블2_키
);

 

 

DELETE
  FROM T_CLASS_DIAG A
 WHERE EXISTS

(
 SELECT 1
   FROM T_PORTFOLIO_HISTORY
  WHERE LECTURE_ID = A.LECTURE_ID
      AND USER_ID = A.USER_ID

);

 

 

## 2 ##

 

DELETE

  FROM SG2EXAMT T1
 WHERE (T1.PATNO,T1.ORDDATE,T1.RESVTYPE)
          = (SELECT PATNO,ORDDATE,RESVTYPE
                FROM SG1RESVT T2
               WHERE T2.CUSTCODE =  '125000'
                   AND T2.ACPTDATE = TO_DATE('20100329','YYYYMMDD')
             ); 

 

 

Trackback 0 Comment 0