title: Teradata - Record split based on date range and timestamp
body: <p>There is a scenario where we have records with overlapping dates and we need to split the records based on dates, considering the recently updated record. 
  Consider the below examples -</p>
  
  <p>Scenario 1:</p>
  
  <h2>Input</h2>
  
  <pre><code>Source  Destination     Begin_Date   End_Date     Last_Updated      Value
  -------------------------------------------------------------------------
  ABC      123            3/15/2015    12/15/2015   3/17/2015 9:18    50
  ABC      123            4/15/2015    5/15/2015    3/18/2015 2:31    44
  </code></pre>
  
  <h2>Ouput</h2>
  
  <pre><code>Source  Destination     Begin_Date   End_Date      Value
  ----------------------------------------------------------
  ABC       123           3/15/2015    4/14/2015     50
  ABC       123           4/15/2015    5/15/2015     44
  ABC       123           5/16/2015    12/15/2015    50
  </code></pre>
  
  <p>Scenario 2:</p>
  
  <h2>Input</h2>
  
  <pre><code>Source  Destination     Begin_Date   End_Date    Last_Updated     Value
  -----------------------------------------------------------------------
  ABC       123           3/15/2015    12/15/2015  3/17/2015 9:18    50
  ABC       123           4/15/2015    12/15/2015  3/18/2015 2:31    44
  </code></pre>
  
  <h2>Ouput</h2>
  
  <pre><code>Source  Destination     Begin_Date   End_Date     Value
  --------------------------------------------------------
  ABC       123           3/15/2015    4/14/2015     50
  ABC       123           4/15/2015    12/15/2015    44
  </code></pre>
  
  <p>Scenario 3:</p>
  
  <h2>Input</h2>
  
  <pre><code>Source   Destination    Begin_Date   End_Date     Last_Updated     Value
  ------------------------------------------------------------------------
  ABC        123          4/15/2015    12/15/2015   3/17/2015 9:18   50 
  ABC        123          3/15/2015    12/15/2015   3/18/2015 2:31   44
  </code></pre>
  
  <h2>Ouput</h2>
  
  <pre><code>Source   Destination    Begin_Date    End_Date     Value
  --------------------------------------------------------
  ABC        123          3/15/2015     12/15/2015     44
  </code></pre>