Hi all,
this is my relational model:
Request
------------------------------
RequestId
------------------------------
1
2
RequestState
------------------------------
RequestStateId | Name
------------------------------
10 | Received
20 | Processing
30 | Finsihed
Request_RequestState
-------------------------------------------------------------------
Request_RequestStateId | RequestId | RequestStateId | CreatedOn
-------------------------------------------------------------------
1 | 1 | 10 | 2010-01-01
2 | 1 | 20 | 2010-01-02
3 | 2 | 10 | 2010-01-15
Each time a request state changes, this change is stored. Now I need to list requests by its current state. Like "Get all requests with current state = Received".
So far I only managed to created a query that return requests of a given state, but it doesn't matter if it is the current state or an older one... So I somehow need to use CreatedOn to get the latest/current state.
Any help? Thanks in advance!