ALTER TABLE `creditDetail` ADD `privyId` VARCHAR(50) NULL DEFAULT NULL AFTER `fileContract`; 

UPDATE `creditDetail` cd 
	JOIN `creditApplication` ca ON cd.creditApplicationId = ca.id 
SET cd.privyId = ca.privyId 
WHERE cd.privyId IS NULL; 