I have a table like this called workorder
id | work order |
---|---|
1 | WO_123 |
2 | W0_124 |
I have another table like this table like this called workupdates here work_id is the equal to id of workorder table
id | update_date | work_id | status_id |
---|---|---|---|
1 | 2022-09-27 | 1 | 152 |
2 | 2022-09-26 | 1 | 100 |
I have another table statuscode , here in this table code is equal to status_id of workupdates table
code | title |
---|---|
152 | Delivered |
100 | Processing |
Now , I want to related workorder table to statuscode table based on what is last updated , which is on workupdates table
So the result will be WO_123 -Delivered