Hi Guys,
I have two tables as follows:
Table 1 - Entries posted by Users
| Document Number | Posting Date | User Name |
| 1900000000 | 01/04/2019 | 1190 |
| 1900000001 | 20/04/2019 | 1190 |
| 1900000002 | 01/04/2019 | 5163 |
| 1900000003 | 10/05/2019 | 5163 |
| 1900000004 | 01/04/2019 | 1196 |
| 1900000005 | 25/04/2019 | 1196 |
| 1900000006 | 10/05/2019 | 1196 |
Table 2 - User Type Changes
| User | Date | From Value | To Value |
| 1190 | 15/04/2019 | A | B |
| 5163 | 30/04/2019 | B | A |
| 1196 | 15/04/2019 | B | A |
| 1196 | 01/05/2019 | A | B |
I want a new column in table 1 as "User Type" and bring the same from Table 2 as "A" or "B" based on the applicable date range.
Output Table should be as follows:
| Document Number | Posting Date | User Name | User Type |
| 1900000000 | 01/04/2019 | 1190 | A |
| 1900000001 | 20/04/2019 | 1190 | B |
| 1900000002 | 01/04/2019 | 5163 | B |
| 1900000003 | 10/05/2019 | 5163 | A |
| 1900000004 | 01/04/2019 | 1196 | B |
| 1900000005 | 25/04/2019 | 1196 | A |
| 1900000006 | 10/05/2019 | 1196 | B |
Does anyone have a solution to this?
(Attached the input files for your reference)