The query code
SELECT * FROM products
LEFT JOIN (SELECT * FROM product_images ) as images ON products.id = images.productId
LEFT JOIN (SELECT * FROM product_shippings ) as shipping ON products.id = shipping.productId
WHERE products.id = :productID
I have multiple images in product_images, but it's only returning one instance.
What I want to do is get it all in a associate array, like images containing a list of images, shipping containing a list of shipping items, etc.
I know how to achieve this using separate queries, but that is way too slow according to my benchmarks.
So I want something like
{
images:[...],
shipping[...],
productId:2,
productTitle:'Hello'
}
How do I fix this issue?