title: How do I perform an efficient left join in kdb?
body: <p>I want to run a conventional SQL-style left join in KDB+ / Q. </p>
  
  <ul>
  <li>We get at least one row in the result for every row in the left
  table.</li>
  <li>If there is more than one match in the right table, I get a row for
  each of those, not just for the first match</li>
  </ul>
  
  <p><strong>Test Data</strong></p>
  
  <pre><code>  x:([];a:1 1 2 3; b:3 4 5 6)
  
    y:([]; a:1 2 2 4; c:7 8 9 10)
  </code></pre>
  
  <p>The best version I can think of goes like this: </p>
  
  <p>This appends a left join which provides only the first match to an inner join which provides all matches and then removes the duplicates:</p>
  
  <pre><code>  distinct ej[`a; x; y] , x lj `a xkey y
  </code></pre>
  
  <p>Can anyone supply me with one that is faster and/or better in some
  other way? I'd really like to avoid the use of distinct, for example.</p>