
INSERT INTO T_BD_SupplierGroupDetail (FID,FSupplierID,FSTANDARDID, FGROUPID) select fid,fid,716529547008326656,fgroupid from T_BD_Supplier where not exists(select fid from T_BD_SupplierGroupDetail where T_BD_Supplier.fid = T_BD_SupplierGroupDetail.fSupplierid) and fgroupid <> 0 and (select count(fid) from T_BD_SupplierGroupDetail) = 0 ;

INSERT INTO T_BD_CustomerGroupDetail (FID,FCustomerID,FSTANDARDID, FGROUPID) select fid,fid,712984405228187648,fgroupid from T_BD_Customer where not exists(select fid from T_BD_CustomerGroupDetail where T_BD_Customer.fid = T_BD_CustomerGroupDetail.fCustomerid) and fgroupid <> 0 and (select count(fid) from T_BD_SupplierGroupDetail) = 0 ;