UPDATE household_quotations SET encoder = ( select t1.lvl3 from household_outlets t1 inner join household_quotations t2 on t2.oid = t1.id where t2.encoder = 1 ) WHERE id in ( select t2.id from household_outlets t1 inner join household_quotations t2 on t2.oid = t1.id where t2.encoder = 1 )