CREATE TABLE `product_groups1` (
  `ProductID` int(10) UNSIGNED NOT NULL,
  `GroupID` int(10) UNSIGNED NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `product_groups1`
  ADD PRIMARY KEY (`GroupID`,`ProductID`),
  ADD KEY `PartID` (`ProductID`),
  ADD KEY `GroupID` (`GroupID`);


INSERT INTO `product_groups1`
SELECT * FROM `product_groups` WHERE `ProductID` IN (SELECT `ID` FROM `products1`);