SQL Delete Rows Based on Another Table

前端 未结 6 1400
别那么骄傲
别那么骄傲 2020-12-13 18:44

This is probably very easy, but it\'s Monday morning. I have two tables:

Table1:

Field        | Type             | Null | Key | Default | Extra
id           


        
6条回答
  •  情书的邮戳
    2020-12-13 19:00

    The nice solution is just writing the SQL as you say it yourself already:

    DELETE FROM Table1
    WHERE
      EXISTS(SELECT 1 FROM Table2 WHERE Table2.Group = Table1.Group)
    

    Regards, Arno Brinkman

提交回复
热议问题