title: Delete using left outer join in Postgres
body: <p>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.</p>
  
  <p>I have two tables of data which list where certain back-up files are located.  Existing data (ed) and new data (nd). This syntax will pick out existing data which might state where a file is located in the existing data table, matching it against equal filename and path, but no information as to where it is located in the new data:</p>
  
  <pre><code>SELECT ed.id, ed.file_name, ed.cd_name, ed.path, nd.cd_name
  FROM tv_episodes AS ed
  LEFT OUTER JOIN data AS nd ON
  ed.file_name = nd.file_name AND 
  ed.path = nd.path
  WHERE ed.cd_name = 'MediaLibraryDrive' AND nd.cd_name IS NULL;
  </code></pre>
  
  <p>I wish to run a delete query using this syntax:</p>
  
  <pre><code>DELETE ed
  FROM tv_episodes AS ed
  LEFT OUTER JOIN data AS nd ON
  ed.file_name = nd.file_name AND 
  ed.path = nd.path
  WHERE ed.cd_name = 'MediaLibraryDrive' AND nd.cd_name IS NULL;
  </code></pre>
  
  <p>I have tried <code>DELETE ed</code> and <code>DELETE ed.*</code> both of which render <code>syntax error at or near "ed"</code>.  Similar errors if I try without the alias of <code>ed</code>. If I attempt </p>
  
  <pre><code>DELETE FROM tv_episodes AS ed
  LEFT  JOIN data AS nd.....
  </code></pre>
  
  <p>Postgres sends back <code>syntax error at or near "LEFT"</code>.</p>
  
  <p>I'm stumped and can't find much on delete queries using joins specific to psql.</p>