I have a table on postgresql with this data:
IdProduction --- IdHistorical --- IdAssociated --- TypeField --- Value
Every time I save a row, I put the production, the historical, the asociated id, the type field and the value.
For example, I put one production with the kilometres of a vehicle, I save Production: 101, Historical: 220, associated id (idVehicle): 24, field type: 01, value: 500.
If I want to update the production, the same production and same historical with another vehicle and other kilometres values. I have on my table the first vehicle, but it has to be deleted or to change the associated id and the value with the new kilometres.
Is there any way to do it without searching for this row and deleting the row "manually"? I mean, is there any update on cascade that do all this stuff?
It could help something like... "insert or update" if the idProduction, idHistorical and TypeField are the same, but the idAssociated and value are different than the previous one.
Thanks a lot!