INSERT INTO T_BD_MaterialGroupDetail (FID,FMaterialID,FSTANDARDID, FGROUPID) select fid,fid,730148448254487552,fgroupid from T_BD_Material where not exists(select fid from T_BD_MaterialGroupDetail where T_BD_Material.fid = T_BD_MaterialGroupDetail.fMaterialid) and fgroupid <> 0 and (select count(fid) from T_BD_MaterialGroupDetail) = 0 ;


