title: Retrieve only selected columns data in r with date criteria
body: <p>I have two tables( orders, prices) and I would like to retrieve the Monthly_code and daily_code from orders table to prices table considering date criteria. Both tables doesn't have a unique primary key.</p>
  <p><a href="https://i.stack.imgur.com/VRgkC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VRgkC.png" alt="orders table" /></a><a href="https://i.stack.imgur.com/OHV81.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OHV81.png" alt="price table" /></a></p>
  <pre><code>**Orders table data**
  
  orders &lt;- data.table(ID = c(1,1,1,2,2,3), Monthly_code = c('xx','xx','vv','uu','mm','gg'),
             daily_code = c('xx-1','xx-1','vv-1','uu-1','mm-1','gg-1'), 
             Time_in = c('12/1/2020','12/16/2020','12/28/2020', '6/1/2020', '4/5/2020', '6/9/2020'),
             Time_out = c('12/6/2020', '12/27/2020', '12/31/2020','6/13/2020','4/12/2020','6/23/2020')
  
  **Prices table data**
  
  prices &lt;- data.table(ID = c(1,1,1,1,2,2,2,3), record_date = c('12/2/2020','12/3/2020','12/4/2020',
                           '12/5/2020', '6/6/2020', '6/7/2020', '6/8/2020' , '6/20/2020'), Price = c(20,22,21,22,13,15,22,30))
  
  **Expected results data**
  
  price_2 &lt;- data.table(ID = c(1,1,1,1,2,2,2,3), record_date = c('12/2/2020','12/3/2020','12/4/2020',
                                                               '12/5/2020', '6/6/2020', '6/7/2020', '6/8/2020' , '6/20/2020'), 
                      Price = c(20,22,21,22,13,15,22,30), Monthly_code = c('xx','xx','xx','xx', 'uu','uu', 'uu','gg'),
                      daily_code = c('xx-1', 'xx-1', 'xx-1','xx-1', 'uu-1', 'uu-1','uu-1','gg-1'))
  
  </code></pre>