-- 同表复制行数据,profit_date字段不同
insert into baby_daily_account_building_relation (account_code, building_uuid,profit_date, create_date)
select account_code,building_uuid,1622563199,1623418377 from baby_daily_account_building_relation where profit_date=1622649599;
-- 存储过程循环插入
delimiter $$
CREATE PROCEDURE fixRelation0520to0607 ( ) BEGIN
DECLARE
i INT DEFAULT 1621439999;
REPEAT
SET i = i + 86400;
INSERT INTO `property_crm`.`baby_daily_account_building_relation` ( `account_code`, `child_account_code`, `building_uuid`, `advertising_price`, `profit_date`, `create_date`, `percentage` )
VALUES
( 'abrh', NULL, '837721275676753920', ' ', i, 1623898563, NULL );
UNTIL i = 1623081599
END REPEAT;
COMMIT;
END $$ CALL fixRelation0520to0607 ( );