title: MYSQL JOIN if field is not null
body: <p>I want to get data from database by reading one whole table, join another one and one more but the last one only if the specified field in first isn't NULL. Here's the query:</p>
  
  <pre><code>SELECT a.*, u1.Name, u2.Name FROM `articles` a
  JOIN `users` u1 ON (a.id=1 AND u1.`id` = a.`authorid` )
  JOIN `users` u2 ON (a.`updaterid` IS NOT NULL AND u2.`id` = a.`updaterid`) 
  </code></pre>
  
  <p>Should work okay but it does not. It returns valid result if updaterid isn't NULL but if it is, I keep getting empty result. Any ideas on this one?</p>
  
  <p>PS I also tried some combinations around this e.g. with WHERE or different kinds of JOINs.</p>