title: Postgresql LEFT JOIN with CASE condition
body: <p>I want to use a CASE condition in PostgreSQL, to decide which column of another table to join with. This is where I am and, I think, explains what I'm trying to do. Would appreciate your thoughts and ideas:</p>
  
  <pre><code>SELECT hybrid_location.*,
         concentration
  FROM   hybrid_location
  CASE   WHEN EXTRACT(month FROM hybrid_location.point_time) = 1 
              THEN LEFT JOIN (SELECT jan_conc FROM io_postcode_ratios) ON
              st_within(hybrid_location.the_geom, io_postcode_ratios.the_geom) = true
         WHEN EXTRACT(month FROM hybrid_location.point_time) = 2 
              THEN LEFT JOIN (SELECT feb_conc FROM io_postcode_ratios) ON
              st_within(hybrid_location.the_geom, io_postcode_ratios.the_geom) = true
         ELSE LEFT JOIN (SELECT march_conc FROM io_postcode_ratios) ON
              st_within(hybrid_location.the_geom, io_postcode_ratios.the_geom) = true
         END AS concentration;
  </code></pre>