title: Questition about SQL - INSERT with DISTINCT and JOIN
body: <p>I'm trying to merge two tables (table1, table2) and insert the new table (table3) in my database. The point is, I need to use the "DISTINCT"-Statement because the number in table1 is not unique.</p>
  
  <p>Here is my Code-Example:</p>
  
  <pre><code>MySQLCommand command = new MySQLCommand();
  command.CommandText = "INSERT INTO table3(number, value, account, date) " + 
  "SELECT DISTINCT(table1.Number), table1.value, table1.account, table2.date FROM table1 " +
  "INNER JOIN table2 ON table1.number = table2.number"
  </code></pre>
  
  <p>I get the Error "The reading from the stream has failed".</p>
  
  <p>Even, when I trying just</p>
  
  <pre><code>"SELECT DISTINCT(table1.Number) FROM table1 " +
  "INNER JOIN table2 ON table1.number = table2.number"
  </code></pre>
  
  <p>or different JOIN-Statements, e.g.</p>
  
  <pre><code>"SELECT DISTINCT(table1.Number) FROM table1 " +
  "LEFT JOIN table2 ON table1.number = table2.number"
  </code></pre>
  
  <p>Thank you for some hints!</p>