I have 2 tables Journal and Users Journal looks like this:
| TransTime | RegNumber | UserID |
|---|---|---|
| 5/26/2022 11:00:00 | 101 | 3 |
| 5/26/2022 11:30:00 | 102 | 2 |
| 5/26/2022 13:00:00 | 101 | 5 |
| 5/26/2022 14:30:00 | 103 | 4 |
| 5/26/2022 15:00:00 | 102 | 1 |
Users table
| UserID | Name |
|---|---|
| 1 | Ross |
| 2 | Rachel |
| 3 | Chandler |
| 4 | Monica |
| 5 | Joey |
What I would like to do is get a table of the Registers and their most recent user names. This should seem very simple. But since I am joining tables on the userID, I am getting all 5 records on the first table. But it should look like this:
| RegNumber | LastUser |
|---|---|
| 101 | Joey |
| 102 | Ross |
| 103 | Monica |
I have tried a variety of solutions but haven't found the right one. Any help is appreciated.