UPDATE products
JOIN (
SELECT
PRODUCT_ID,
GROUP_CONCAT(FILENAME SEPARATOR '","') IMAGES
FROM images
GROUP BY PRODUCT_ID
) images ON images.PRODUCT_ID = products.ID
SET NEW_IMAGE = CONCAT('["', IMAGES, '"]');
SELECT * FROM products;
product.setBrandId(1);
product.setProductTypeId(1);
product.setCategoryId(1);
product.setBrandId(2);
product.setProductTypeId(2);
product.setCategoryId(2);
product.setBrandId(brand.id);
product.setProductTypeId(productType.id);
product.setCategoryId(category.id);
product.setBrandId(brand.getIdByName('...'));
product.setProductTypeId(productType.getIdByName('...'));
product.setCategoryId(category.getIdByName('...'));