title: SQL - Conditional return of joined results
body: <p>I have two tables: Items and Prices with a common item ID key. The relationship is one:many, so one Item can have many Prices.</p>
  
  <p>The price table has these columns:
  <code>itemID</code>
  <code>priceType</code>
  <code>price</code></p>
  
  <p>What I want to do is select an item by one of its other columns, join to the price table via item ID, and pull prices according to some criteria like this:</p>
  
  <pre><code>-if PriceType='primary' then price
  -if PriceType='alternate' then price (no primary price is set)
  -if PriceType='other' then price (no primary or alternate price is set)
  </code></pre>
  
  <p>Basically, if primary price is not defined, grab the secondary price and so on. I only want one row returned regardless of how many PriceTypes there are and I want to specify the order in which that single item would be returned.</p>