title: LEFT JOIN if a condition is met otherwise continue to select others
body: <p>I have looked around for something that would fit what I'm looking for. I am by no means close to a SQL expert so I'm asking here. I want to grab a and b regardless of if c exists, but if c does exist LEFT JOIN it to the return. Here is the statement I am working with at the moment:</p>
  
  <pre><code>SELECT a.display_name, a.first_name, a.last_name, a.profile_image, a.tagline,
         a.bragging_rights, a.about_me, b.type AS post_type, b.title AS post_title,
         b.published AS post_published, b.updated AS post_updated,
         b.content AS post_content, b.num_replies AS post_replies, 
         b.num_plus_ones AS post_plus_ones, b.num_reshares AS post_reshares,
         c.display_name AS attach_display_name, c.content AS attach_content,
         c.url AS attach_url, c.image_url AS attach_image,
         c.image_width AS attach_width, c.image_height AS attach_height,
         c.full_image_url AS attach_full_image
    FROM cr_google_profiles a
    JOIN cr_google_posts b
    LEFT JOIN cr_google_post_attachements c 
      ON b.post_id = c.post_id
   WHERE a.google_id = :google_id AND b.google_id = :google_id AND c.google_id = :google_id
  </code></pre>
  
  <p>I'm really lost on how to do this; I've been YouTubing and reading the manual but haven't come up with anything that would accomplish what I'm looking for. Any help or constructive criticism is more than welcome.</p>