title: Date wise update records from multiple tables
body: <p>My requirement is like this</p>
  
  <p>I have 3 tables table 1, table 2 and table 3 with address number common between all 3 tables  </p>
  
  <p>table 1 has address number as primary key hence only one record will be there for each address number. table 2 and table 3 has multiple records for each address number</p>
  
  <p>I need to udapte the section column in table 3 based on the effective date from table 2 for each address number fetched from table 1.</p>
  
  <p>Hence we need to fetch the address number from table 1, pass it to table 2 and filter the number of records for that address number. After fitlering i have to fetch the least effective date if there are more than one record in the table 2. Then pass the address number and the effective date as >= Effective date to the table 3 and filter the records for address number with dates greater than or equal to the effective date. Passs the section value from the table 2 to section column of all the filtered records of table 3.</p>
  
  <p><strong>Example:
  Table structure:</strong></p>
  
  <p><strong>Table 1: (one column - address number)</strong>
  Address number - 100</p>
  
  <p>Fetch the address number from table 1  - 100</p>
  
  <p><strong>Table 2:  (3 columns - adddress number, section, Effective date)</strong>
  Address number - 100
  Section -  A
  Effective date - 1/1/2014</p>
  
  <p>Address number - 100
  Section - B
  Effective date - 1/1/2015</p>
  
  <p>In table 2 you have 2 records as shown above for address number 100 with section A and B and with different dates.</p>
  
  <p>From these 2 records select the least effective date (1/1/2014 is the least effective date). Pass the Address number as - 100 and Date as >= 1/1/2014 to Table 3 (>= should be hardcoded) </p>
  
  <p><strong>Table 3:  (3 columns - adddress number, section, date)</strong></p>
  
  <p>Address number - 100
  Section -
  Date 2/2/2014</p>
  
  <p>Address number - 100
  Section - 
  Date - 2/2/2015</p>
  
  <p>Address number - 100
  Section - 
  Date 3/3/2015</p>
  
  <p>Table 3 consists of 3 records for address number 100 with different dates and no values for Section column</p>
  
  <p>we pass the Address number and >= Effective date to the table 3 and filter the records. As per the above example all 3 records are >= 1/1/2014. Now pass the Section value of 1/1/2014 (value = A) from Table 2 to Table 3 for all 3 records.</p>
  
  <p>Next pass the second least effective date from Table 2  (1/1/2015). Pass the address number and date as >= 1/1/2015. as per the above example 2 records will be filtered. 2/2/2015 and 3/3/2015. Pass the Section value of 1/1/2015 (section B) to 2/2/2015 and 3/3/2015 record</p>
  
  <p><strong>Expected Result in Table 3</strong></p>
  
  <p><strong>Table 3:</strong> </p>
  
  <p>Address number - 100
  Section - A
  Date 2/2/2014</p>
  
  <p>Address number - 100
  Section - B
  Date 2/2/2015</p>
  
  <p>Address number - 100
  Section - B
  date 3/3/2015</p>