update PackingRecord set tousseDefinitionId=(select distinct ti.tousseDefinition_id from TousseInstance ti where ti.packingRecord_id=PackingRecord.id) where tousseDefinitionId is null;