title: How do I join two tables with different column in SQL Server CE?
body: <p>How can I joining two tables with different column in SQL Server CE? </p>
  
  <p>I have two tables:</p>
  
  <p>Table <strong>Schedule</strong></p>
  
  <pre><code>+-----+----------+------+
  + ID  + Name     + Type +
  +-----+----------+------+
  + 1   + A        + 1    +
  + 2   + B        + 1    +
  + 3   + C        + 2    +
  +-----+----------+------+
  </code></pre>
  
  <p>Table <strong>Description</strong></p>
  
  <pre><code>+-----+--------------------+
  + ID  + Description        +
  +-----+--------------------+
  + 1   + A1 - XXXXX         +
  +-----+--------------------+
  </code></pre>
  
  <p>And what I want to get is the table like:</p>
  
  <pre><code>+-----+----------+-----------------+
  + ID  + Name     + Description     +
  +-----+----------+-----------------+
  + 1   + A        + A1 - XXXXX      +
  + 2   + B        + -               +
  + 3   + C        + -               +
  +-----+----------+-----------------+
  </code></pre>
  
  <p>Where the <code>Description</code> column should be filled in by <code>-</code> when the ID is not on the <code>Description</code> table.</p>
  
  <p>I tried this code:</p>
  
  <pre><code>SELECT S.ID, D.Description 
  FROM Schedule AS S 
  INNER JOIN Description AS D
  </code></pre>
  
  <p>But resulted in:</p>
  
  <pre><code>+-----+----------+-----------------+
  + ID  + Name     + Description     +
  +-----+----------+-----------------+
  + 1   + A        + A1 - XXXXX      +
  + 2   + B        + A1 - XXXXX      +
  + 3   + C        + A1 - XXXXX      +
  +-----+----------+-----------------+
  </code></pre>
  
  <p>And when I tried to give ON Clause:</p>
  
  <pre><code>SELECT S.ID, D.Description 
  FROM Schedule AS S 
  INNER JOIN Description AS D ON S.ID = D.ID
  </code></pre>
  
  <p>It just get the row where the <code>ID</code> is on the <code>Description</code> table, like:</p>
  
  <pre><code>+-----+----------+-----------------+
  + ID  + Name     + Description     +
  +-----+----------+-----------------+
  + 1   + A        + A1 - XXXXX      +
  +-----+----------+-----------------+
  </code></pre>
  
  <p>How can I do that? </p>
  
  <hr>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>I tried this code and it works:</p>
  
  <pre><code>SELECT  S.ID, S.Name, COALESCE (D.Description, '-') AS Description
  FROM Schedule AS S 
  LEFT OUTER JOIN Description AS D ON S.ID = D.ID
  </code></pre>
  
  <p>But now, how can I add a WHERE clause on it (pls see table <code>SCHEDULE</code> above)?</p>
  
  <p>I tried:</p>
  
  <pre><code>SELECT  S.ID, S.Name, COALESCE (D.Description, '-') AS Description
  FROM Schedule AS S 
  LEFT OUTER JOIN Description AS D ON S.ID = D.ID AND S.Type = '1'
  </code></pre>
  
  <p>But still get the whole rows.</p>