title: SQL, conditional column values?
body: <p>One of the columns in my table is "DataSource". Datasource can have two values, lets say "A" or "B". I would like to always take the row when Datasource = "A", however, if there isn't an entry for A I would like to take "B".</p>
  
  <p>How does one do this in SQL Server?</p>
  
  <p>EDIT:</p>
  
  <p>So for a partucular product (Product ID) one Product ID may have two rows, each containing a different DataSource, wheres another ProductID may only have one DataSource:</p>
  
  <pre><code>{ProductID DataSource}
  {1  A},
  {1  B},
  {2  B}
  </code></pre>
  
  <p>Here I would wish to select the top and bottom row</p>