Database: MS SQL 2008
SELECT Listing.Title, Listing.MLS, Pictures.PictureTH, Pictures.Picture, Listing.ID
FROM Listing INNER JOIN Pictures
Use left outer join
instead of inner join
Inner join
will return results if and only if there is a result that satisfies the join.
Left outer join
will return results from the left side table, and if the join is satisfied also add results from the right side table..
If you need to convert the null values returned from the non-satisfying joins, then use coalesce
function like coalesce(Pictures.Picture, 'default.jpg')