Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

regarding the conversion of currency from INR to n e other currency - response (2) by VBurmist

$
0
0

Hi Peiter, 
when you join two tables, both of them having start_date and end_date, then the join condition for those columns (in addition to currency_code, etc.) should be:
 
      table1.start_date <= table2.end_date
and table2.start_date <= table1.end_date
 
With these conditions, you get the rows that have "intersecting" time periods.    
 
And the new periods are:
case when table1.start_date <= table2.start_date then table2.start_date else table1.start_date end as NEW_START_DATE, /* greatest (...) */
 
case when table1.end_date <= table2.end_date then table1.end_date else table2.end_date end as NEW_END_DATE, /* least (...) */

 

Should be tested, of course.

 

Regards,

Vlad.


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>