title: Subset data.table by another data.table without merging all columns
body: <p>With data.table, I'd like to subset a table according to another one.</p>
  
  <pre><code>DT1 &lt;- data.table( A = c(1:5,1:2), B = c(1,1,1,2,2,2,3), C = c(1:3))
  DT2 &lt;- data.table( A = c(1, 2, 3), B = c(1,3,1), D = c(4:6))
  </code></pre>
  
  <p>The output should contain only columns of the first table.</p>
  
  <pre><code>   A B C
  1: 1 1 1
  2: 2 3 1
  3: 3 1 3
  </code></pre>
  
  <p>With the merge function I get columns of both table</p>
  
  <pre><code>merge(DT1, DT2, by = c("A", "B"))
  
         A B C D
      1: 1 1 1 4
      2: 2 3 1 5
      3: 3 1 3 6
  </code></pre>
  
  <p>Since my datasets have much more columns, I'm looking for a way to get the result without the merge function, but with the data.table syntax [i, j, by].
  However, with subsetting the first table it doesn't merge correctly.</p>
  
  <pre><code>DT1[A %in% DT2[,A] &amp; B %in% DT2[, B]]
  
         A B C
      1: 1 1 1
      2: 2 1 2    &lt; wrong
      3: 3 1 3
      4: 2 3 1
  
  DT1[A == DT2[,A] &amp; B == DT2[, B]]
         A B C
      1: 1 1 1
      2: 3 1 3
      Warning messages:
      1: In A == DT2[, A] :
        longer object length is not a multiple of shorter object length
      2: In B == DT2[, B] :
        longer object length is not a multiple of shorter object length
  </code></pre>
  
  <p>Is there a way to get the correct rows like with merge, but using the data.table Syntax [ ]?</p>