UPDATE machines SET machines.Type = machines_type.Type
WHERE Reference IN (SELECT machines.Reference, machines_type.Reference
FROM machines
LEFT JOIN machines_type
ON machines.Reference = machines_type.Reference
WHERE machines.Id IS NOT NULL )