lets say I have the following tables:
Cars
--------
ID Make Model Version
1 Honda Accord v1
2 Honda Civic v1
3 Honda Odysey v1
1 Honda AccordLX v2
1 Honda AccordEX v3
CarProperties
-------------
CarID key value Version
1 color red v1
1 doors 4 v1
2 color blue v1
2 doors 2 v1
3 color black v1
1 color blue v2
1 color green v3
Versions
-----------
ID Status
v1 Approved
v2 Pending
v3 Approved
Basically, I have a entry / properties type pattern that I'm trying to do version management on.
How can I query this to always get the latest approved version of a car with all of its properties? Note that some properties may not be updated in a particular version. ie: in the example below, the approved version of carid:1 is
Honda AccordEX color:green doors:4
Some data coming from V3 and other data coming from V1.
This sounds like there would be a well developed pattern for managing this type of data. Can somebody please point me into the right direction?