title: Filling in Gaps in SQL when I have multiple records per day
body: <p>I have a table of rates that looks like this.</p>
  
  <pre><code>rate_date | rate_num | fxd_code | var_code | ratecode |   rate   
  01/01/Jan |    1     |   USD    |   EUR    |   CASH   |  1.24569  
  01/01/Jan |    1     |   USD    |   EUR    |   TRF    |  1.28795  
  01/01/Jan |    2     |   USD    |   EUR    |   CASH   |  1.28795  
  01/01/Jan |    1     |   USD    |   GBP    |   CASH   |  1.24569  
  01/01/Jan |    1     |   USD    |   EUR    |   CASH   |  1.24569    
  </code></pre>
  
  <p>For each day there are two rates per unique <code>fxd_code</code>, <code>var_code</code> and <code>ratecode</code> combination. These rates are distinguished by the <code>rate_num</code> column.</p>
  
  <p>For some days, there are no rates in the table. What I want to do is to fill in missing dates with the most recent available day in the table. I have found some queries that do this for single distinguishing parameters but I need one that can select the most recent considering the <code>rate_num</code>, <code>fxd_code</code>, <code>var_code</code> and <code>ratecode</code>.</p>
  
  <p>Help will be really appreciated.</p>
  
  <p>Thanks.</p>