title: DELETE with LEFT JOIN
body: <p>I get daily a CSV-File as an update for one of my Access-Tables (hereinafter: targetTable) with appr. 20 to 30.000 lines. For that I created tempTable where load the CSV-File into with ADODB.Stream and do some check ups and after the successful check ups I load all entries in the tempTable.</p>
  
  <p>I could delete the targetable completely and insert all entries from the tempTable but will check if any entry is new or not (which means it was already delivered in the past). For this purpose, I have a column “discovered” where I store the date when this specific entry first occurs. I’ll check all columns from the tempTable with all columns from the targetTable.</p>
  
  <p>The table has nearly 15 columns and my first solution was like this:</p>
  
  <pre><code>DELETE * FROM targetTable WHERE (SELECT COUNT(*) FROM tempTable WHERE (targetTable.Id = tempTable.Id) AND (targetTable.Start = tempTable.Start) AND (targetTable.End = tempTable.End) ... 
  INSERT INTO targetTable SELECT tempTable.* FROM tempTable LEFT JOIN targetTable ON (targetTable.Id = tempTable.Id) AND (targetTable.Start = tempTable.Start) AND (targetTable.End = tempTable.End)
  </code></pre>
  
  <p>The performance of the DELETE statement was really bad so I tried this:</p>
  
  <pre><code>DELETE targetTable .* FROM targetTable LEFT JOIN tempTable ON ON (targetTable.Id = tempTable.Id) AND (targetTable.Start = tempTable.Start) AND (targetTable.End = tempTable.End) WHERE tempTable.Id Is Null;
  </code></pre>
  
  <p>I get the error message “Deleting in this tables aren’t possible”. In the datasheet view the speed seems very high, but there must be something wrong in my statement.</p>
  
  <p>Does anybody have an idea or a better solution?</p>