Update a table, feeding a column from inner join of two other tables as reference