Home » SQL & PL/SQL » SQL & PL/SQL » Union and sort the data based on date range (11G)
Union and sort the data based on date range [message #677020] |
Wed, 07 August 2019 19:28  |
laknar
Messages: 30 Registered: February 2009
|
Member |
|
|
There are two tables which need to be combined based on date range and last transaction date. Consecutive records should be within the date range.
Table1:-
Acc_no, acc_name,type,open_date, last_modified_dt
1001,corporate,S,1990-10-10, 2018-12-01
Table2:-
Acc_no, address,type,from_date, to_date, last_modified_dt
1001,blvd, C, 1990-10-10, 2000-12-01, 2018-12-12
1001, Fredericksburg, C, 1990-10-10, 2012-05-13, 2019-01-31
1001, Fredericksburg, C, 2012-10-10, 2018-05-13, 2019-03-31
Output:-
1001, Fredericksburg, C, 2019-03-31
1001,blvd, C, 2018-12-12
1001, Fredericksburg, C, 2019-01-31
1001,corporate,S,2018-12-01
|
|
|
|
|
Goto Forum:
Current Time: Wed Mar 22 06:53:13 CDT 2023
|