Hi guys,
is it possible and/or optimal from the point of relational database to have in-table relationships?
My issue:
I have Table called Car Logbook where I put mileages I have traveled. When i travel somewhere I always put total tachometer value (Tachometer End Mileages) and Distance into appropriate field together with Car ID, so my current design is like this:
My problem is, that distance can be calculated as difference between previous Tachometer End Mileages and thus Distance field is very prone to errors. The problem I have is, that I'm stuck with how to design this relationship "Current — Previous Travel". I thought it would be possible to add another field where I put ID of previous travel so there is clear relationship, but I cannot create this kind of query (Access do not let me to do it) and to manually insert TravelIDs is error-prone.
Do you have any suggestions about how to design this issue without unnecessary tables?
Many thanks!
is it possible and/or optimal from the point of relational database to have in-table relationships?
My issue:
I have Table called Car Logbook where I put mileages I have traveled. When i travel somewhere I always put total tachometer value (Tachometer End Mileages) and Distance into appropriate field together with Car ID, so my current design is like this:
TravelID | Date | CAR ID | Distance | Tachometer End Mileages |
---|---|---|---|---|
# | 7.7.2020 | 1AH1234 | 500 | 65536 |
My problem is, that distance can be calculated as difference between previous Tachometer End Mileages and thus Distance field is very prone to errors. The problem I have is, that I'm stuck with how to design this relationship "Current — Previous Travel". I thought it would be possible to add another field where I put ID of previous travel so there is clear relationship, but I cannot create this kind of query (Access do not let me to do it) and to manually insert TravelIDs is error-prone.
Do you have any suggestions about how to design this issue without unnecessary tables?
Many thanks!