Delete from one table with join

后端 未结 4 1193
余生分开走
余生分开走 2020-12-01 09:16

I\'m trying to delete records from one database based on a selection criteria of another. We have two tables, emailNotification which stores a list of jobs and emails. Then

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 09:30

    You could try something like the following:

    DELETE FROM emailNotification
    WHERE jobId IN (
     SELECT jobId FROM jobs j
     WHERE j.active = 1
    )
    

提交回复
热议问题