I get data with multiple columns ( select ), which differ only in one img field. As a result, many duplicates are created.
How to combine the img field?
Just need to get the combined data img.
Now the sample looks like this:
- fields with the same values
img one
fields with the same values
- img other
Then the fields are already different, but the problem of creating duplicates naturally remains.
Table structure:
`product` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent` int(11) DEFAULT '0', `url` varchar(255) DEFAULT NULL, `name` varchar(255) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=400005659 ; `product_img` ( `id` int(10) NOT NULL AUTO_INCREMENT, `parent` int(10) unsigned NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `parent` (`parent`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=143077 ; I am writing a query of the form:
SELECT product.url, product.name, product_img.name as product_img_name FROM product JOIN product_img ON product_img.parent=product.parent