Exists table temporary_meta_product
with structure
CREATE TABLE `temporary_meta_product` (
`meta_product_id` int(11) NOT NULL,
`product_code` int(11) NOT NULL,
UNIQUE KEY `META_PRODUCT_UNIQUE` (`meta_product_id`,`product_code`)
) ENGINE=InnoDB;
and data
+ -------------------- + ----------------- +
| meta_product_id | product_code |
+ -------------------- + ----------------- +
| 54306361 | 3533719 |
| 54306361 | 3533720 |
| 54306361 | 3533721 |
| 54306361 | 3533722 |
| 54306361 | 3533723 |
| 54306361 | 3533724 |
| 54306361 | 3533725 |
| 54306361 | 3533726 |
| 54306361 | 3533727 |
| 54306361 | 3533728 |
+ -------------------- + ----------------- +
| 54306577 | 3533870 |
| 54306577 | 3533871 |
| 54306577 | 3533872 |
| 54306577 | 3533873 |
| 54306577 | 3533874 |
| 54306577 | 3533875 |
| 54306577 | 3533876 |
| 54306577 | 3533877 |
| 54306577 | 3533878 |
| 54306577 | 3533879 |
+ -------------------- + ----------------- +
Need reduce table or create new reduced
I new table need 5 rows or less for all meta_product_id
, expect:
+ -------------------- + ----------------- +
| meta_product_id | product_code |
+ -------------------- + ----------------- +
| 54306361 | 3533719 |
| 54306361 | 3533720 |
| 54306361 | 3533721 |
| 54306361 | 3533722 |
| 54306361 | 3533723 |
| 54306577 | 3533870 |
| 54306577 | 3533871 |
| 54306577 | 3533872 |
| 54306577 | 3533873 |
| 54306577 | 3533874 |
| 54306784 | 3534021 |
| 54306784 | 3534022 |
+ -------------------- + ----------------- +