title: Setting a column value in the SELECT Statement based on a value existing in another table
body: <p>I have 2 tables. One table lists all the records of items we track.  The other table contains flags of attributes of the records in the first table.</p>
  
  <p>For example, Table 1 has columns</p>
  
  <pre><code>Tab1ID, Name, Address, Phone
  </code></pre>
  
  <p>Table 2 has these columns</p>
  
  <pre><code>Tab2ID, Tab1ID, FlagName
  </code></pre>
  
  <p>There is a 1 to Many relationship between Table1 and Table2 linked by Tab1ID.</p>
  
  <p>I'd like to create a query that has all the records from Table1 in it.  However, if one of the records in Table2 has a Flagname=Retired (with a matching Tab1ID) then I want a "Y" to show up in the select column list otherwise an "N".</p>
  
  <p>I think it might look something like this:</p>
  
  <pre><code>Select Name, Address, Phone, (select something in table2)
  from Table1
  where Tab1ID &gt; 1;
  </code></pre>
  
  <p>It's the subquery in the column that has me stumped.</p>
  
  <p>Pat</p>