2017-06-08 7 views
-1

私はいくつかの助けが必要です、私は行以上を返すことができるposgreSQLサブクエリが必要です。これまで私が持っていたクエリの部分は、私は行以上のposgresqlが必要です

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 

ありがとう!

+1

dbスキーマ、サンプルデータ、予想される出力を表示します。 \t [** How-to-Ask **](http://stackoverflow.com/help/how-to-ask) \t \t [**スタート**] (http://spaghettidba.com/2015/04/24/how-to-post-at-sql-question-on-a-public-forum/)質問品質を改善し、より良い回答を得る方法を学ぶことができます。 \t [**最小限で完全で検証可能な例を作成する方法**](http://stackoverflow.com/help/mcve) –

答えて

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 
+0

ありがとう!それはうまく動作します:D –

関連する問題