In the first table, I have client number, start date and other columns:
| Client number | start date | other1 | other2 |
|---|---|---|---|
| xyz | 2024-04-01 | values10 | values20 |
| abc | 2024-01-02 | values11 | values21 |
| ert | 2024-01-03 | values12 | values22 |
In the second table, I have information about client bank account for everyday:
| Date | Client number | account balance |
|---|---|---|
| 2024-03-01 | xyz | 500.0000 |
| 2024-04-01 | xyz | 1000.0000 |
| 2024-04-02 | xyz | 1000.0000 |
| 2024-04-03 | xyz | 1200.0000 |
| 2024-04-01 | abc | 2200.0000 |
| 2024-04-02 | abc | 2300.0000 |
| 2024-04-03 | abc | 2400.0000 |
I want to join table 1 and table 2 to get information about client account from the start date from table 1.
For example client xyz has start date 2024-04-01, so in my result set, I want to have:
| Date | Client number | account balance |
|---|---|---|
| 2024-04-01 | xyz | 1000$ |
| 2024-04-02 | xyz | 1000$ |
| 2024-04-03 | xyz | 1200$ |
| 2024-04-02 | abc | 2300$ |
| 2024-04-03 | abc | 2400$ |
For client xyz I don't want information before 2024-04-01, and for client abc, I don't want information before 2024-04-02.
Problem is that I don't know what conditions to provide to limit client in the second table in relation to the start date.
I do not know how to build key to join tables with date condition