update QualityMonitoringInstance set barcode = (select q.barcode from QualityMonitoring  q where q.id = QualityMonitoringInstance.sourceId) where QualityMonitoringInstance.sourceId is not null