update IDCardDefinition set curIdCardInstanceBarcode=(select max(b.barcode) from IDCardInstance i inner join barcodeDevice b on i.id=b.id where i.idCardDefinitionID=IDCardDefinition.id and i.status='使用中' and b.barcode is not null);