我需要一个可以返回多行的PostgreSQL子查询。这是我到目前为止的查询部分:
select (SELECT ARRAY[url, thumb_1, thumb_200, thumb_500]
FROM "Image"
LEFT JOIN "Product_Image"
ON "Image".id = "Product_Image".image_id
WHERE "Product_Image".product_id = 517
ORDER BY "Product_Image".sort ASC) as images
答案 0 :(得分:0)
将子查询放在FROM
子句中吗?
select vals
from (SELECT ARRAY[url, thumb_1, thumb_200, thumb_500] as vals
FROM "Image" LEFT JOIN
"Product_Image"
ON "Image".id = "Product_Image".image_id
WHERE "Product_Image".product_id = 517
) images