I have a table, where I need to update a data that is in another table according to a key, but it does not update the data correctly.
Update KM_ficha set FichaActual = rtrim(ltrim(B.Idhistorial)) from KM_ficha A, [dbo].[base datos cliente] B where ltrim(rtrim(A.rut)) = ltrim(rtrim(B.rut))
However, the data is not updated in the column of table A. What am I doing wrong?
I miss a detail. Table B has repeated records, and I need to use the most current one based on Idhistorial