Delete using left outer join in Postgres

前端 未结 4 1203
轮回少年
轮回少年 2021-02-06 22:50

I am switching a database from MySQL to Postgres SQL. A select query that worked in MySQL works in Postgres but a similar delete query does not.

I have two tables of da

4条回答
  •  暖寄归人
    2021-02-06 23:40

    Use the DELETE... USING syntax:

    DELETE FROM tv_episodes USING data WHERE 
    tv_episodes.file_name = data.file_name AND 
    tv_episodes.path = data.path AND 
    tv_episodes.cd_name = 'MediaLibraryDrive' AND 
    data.cd_name IS NULL;
    

提交回复
热议问题