title: mysql left join order by null values to the end
body: <p>mysql</p>
  
  <pre><code>SELECT * FROM media
  LEFT JOIN media_priority
  ON (media_priority.media_id = media.id AND media_priority.media_tag = '".$tag."')
  WHERE something = 'something'
  ORDER BY media_priority.media_order;
  </code></pre>
  
  <p>This works fine except that media_priority.media_order sometimes comes back as null and mysql puts the null values at the top.</p>
  
  <p>So I was trying to figure out how to do an IS NULL AS tempcol statement with my left join so I can order by that first.....I just can't seem to get the syntax right.</p>
  
  <p>Where would I put the IS NULL statement in my query above?</p>
  
  <p>I was thinking something like:</p>
  
  <pre><code>LEFT JOIN media_priority
  ON (media_priority.media_id = media.id AND media_priority.media_tag = '".$tag."')
  media_priority.media_order IS NULL AS isnull
  </code></pre>
  
  <p>but that doesn't work.</p>