title: SQL Select Return Default Value If Null
body: <p>Database: <strong>MS SQL 2008</strong></p>
  
  <pre><code>SELECT Listing.Title, Listing.MLS, Pictures.PictureTH, Pictures.Picture, Listing.ID 
  FROM Listing INNER JOIN Pictures ON Listing.ID = Pictures.ListingID
  WHERE (Pictures.ID = (SELECT MIN(ID) FROM Pictures WHERE (ListingID = Listing.ID)))
  </code></pre>
  
  <p>The issue is, I have several "Listings" without a Picture, and because of this SQL script they don't show up. How can I get them to show up?</p>
  
  <p>Maybe give the Pictures.Picture Column a value of "default.jpg" if the value is null? I'm pretty lost on this, so if someone could help, that'd be amazing. Sorry if I'm asking the question poorly as well, I dont understand how to ask really what I need it to do. But ask for more details and I'll post them.</p>
  
  <p>Each Listing can have as many pictures as the user wants, I need this script to display a Listing even if it doesn't have a picture.</p>
  
  <hr>
  
  <p>PHASE 2</p>
  
  <hr>
  
  <p>Thank you all. So far I'm learning some new commands I never even knew existed. The issue now is its returning a row for each picture a listing has. But the default image is working great.</p>
  
  <pre><code>SELECT Listing.Title, Listing.MLS, coalesce(Pictures.PictureTH, '../default_th.jpg') as PictureTH, coalesce(Pictures.Picture, '../default.jpg') as Picture, Listing.ID FROM Listing LEFT
  OUTER JOIN Pictures ON Listing.ID = Pictures.ListingID
  </code></pre>
  
  <p>How can I get it so it only returns 1 row per ListingID ?</p>