SQL Delete Rows Based on Another Table

前端 未结 6 1386
别那么骄傲
别那么骄傲 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:06

    I think this is what you want:

    DELETE FROM `table1`
    WHERE `group` in (SELECT DISTINCT `group` FROM `table2`)
    

提交回复
热议问题