2012. 11. 23. 13:44

[MS-SQL] JOIN UPDATE / DELETE

[예제] JOIN UPDATE

 

UPDATE TABLE_MAIN
      SET TABLE_MAIN.REGUSR = '쫑'
   FROM TABLE_JOIN
 WHERE TABLE_JOIN.SEQNUM = TABLE_MAIN.SEQNUM
     AND TABLE_JOIN.PROGBN = 'Y'

 

 

[예제] JOIN DELETE

 

DELETE TABLE_MAIN
   FROM TABLE_JOIN
 WHERE TABLE_JOIN.SEQNUM = TABLE_MAIN.SEQNUM
     AND TABLE_JOIN.PROGBN = 'Y'

 


조인을 이용한 UPDATE/DELETE 구문의 FROM 절 이후는 똑같다.

Trackback 0 Comment 0