title: Use `j` to select the join column of `x` and all its non-join columns
body: <p>I have two data tables:</p>
  
  <pre><code>library(data.table)
  d1 &lt;- data.table(grp = c("a", "c", "b", "a"), val = c(2, 3, 6, 7), y1 = 1:4, y2 = 5:8)
  
  d2 &lt;- data.table(grp = rep(c("a", "b", "c"), 2),
                   from = rep(c(1, 5), each = 3), to = rep(c(4, 10), each = 3), z = 11:16)
  </code></pre>
  
  <p>I perform a non-equi join where the value 'val' in 'd1' should fall within the range defined by 'from' and 'to' in 'd2' for each group 'grp'.</p>
  
  <pre><code>d1[d2, on = .(grp, val &gt;= from, val &lt;= to), nomatch = 0]
  #    grp val y1 y2 val.1  z
  # 1:   a   1  1  5     4 11
  # 2:   c   1  2  6     4 13
  # 3:   a   5  4  8    10 14
  # 4:   b   5  3  7    10 15
  </code></pre>
  
  <p>In the output, the join variables are from <code>i</code> ('val' and 'val.1', with the values of respectively 'from' and 'to' in 'd2'). However, I would like to have <code>x</code>'s join column instead. Now, because...</p>
  
  <blockquote>
    <p>Columns of <code>x</code> can now be referred to using the prefix <code>x.</code> and is particularly useful during joining to refer to <code>x</code>'s join columns as they are otherwise masked by <code>i</code>'s.</p>
  </blockquote>
  
  <p>...this could be achieved by specifying <code>val = x.val</code> in <code>j</code>:</p>
  
  <pre><code>d1[d2, .(grp, val = x.val, z), on = .(grp, val &gt;= from, val &lt;= to), nomatch = 0]
  </code></pre>
  
  <p>In order to avoid typing all non-join columns (possibly many) from <code>x</code> in <code>j</code>, my current work-around is to join the above with the original data, which gives the desired result:</p>
  
  <pre><code>d1[d1[d2, .(grp, val = x.val, z), on = .(grp, val &gt;= from, val &lt;= to), nomatch = 0]
     , on = .(grp, val)]
  #    grp val y1 y2  z
  # 1:   a   2  1  5 11
  # 2:   c   3  2  6 13
  # 3:   a   7  4  8 14
  # 4:   b   6  3  7 15
  </code></pre>
  
  <p>However, this seems a bit clumsy. Thus my question: how can I select the join column from <code>x</code> and all non-join columns from <code>x</code> in <code>j</code> in one go?</p>
  
  <hr>
  
  <p>PS I have considered switching the <code>x</code> and <code>i</code> data sets, and the conditions in <code>on</code>. Although that produces the desired join values, it still requires post-processing (deleting, renaming and reordering of columns).  </p>