title: INNER JOIN if null columns
body: <pre><code>x table 
  id - name   - balance
  1 - test    - 500
  2 - test 2  - 400
  3 - test 3  - 300
  
  y table
  idx - idy - name
  1   - null
  2   - 5
  3   - null
  4   - 6
  
  SELECT x.Name, SUM(x.Balance)
  FROM x
  INNER JOIN y ON ???
  
  if IS NULL y.idy ON (x.id = y.idx)
  ELSE ON (x.id = y.idy)
  </code></pre>
  
  <p>My English is not enough to tell the problem. but my problem is understandable</p>