title: Select script to include count of another table?
body: <p>I'm trying to figure out how to write a script to select certain records/fields from one table, then join it to another table and include a column for a corresponding count. For example, this is what I have now:</p>
  
  <pre><code>select ID, Val from OriginalTable where Something = 1
  </code></pre>
  
  <p>Now I have another table which has records linking to this original table, where the a column <code>OriginalID</code> matches the <code>ID</code> of the <code>OriginalTable</code>. One example would be:</p>
  
  <pre><code>select * from OtherTable where OriginalID = 3
  </code></pre>
  
  <p>...where 3 = the <code>ID</code> of the <code>OriginalTable</code>.</p>
  
  <p>What I'd like to do is add a column to the first statement which shows a count of the other table as shown in the second query. For example, this might be a result set:</p>
  
  <pre><code>ID    Val    Count
  1     abc    15
  2     def    23
  3     ghi    42
  4     jkl    19
  </code></pre>
  
  <p>How do I write this query to include this count?</p>