본문 바로가기

MySQL

SELECT 후 DELETE 하기


참조 링크

- http://stackoverflow.com/questions/4562787/how-to-delete-from-select-in-mysql


예)

    DELETE FROM Alpha

    WHERE id IN ( 

    SELECT * FROM ( 

    SELECT a.id 

    FROM Alpha a INNER JOIN Beta b ON a.id = b.alpha_id  

    WHERE a.sample = 'hello' AND b.bar = 88

    ) temp

     

    )