I have a query that need to be sorted in order of price of store's product with unique store number.
Here is a sample data of storeproduct table:
ItemSku , StoreNumber , Price
==========================
10001 , 7 , 30.00
10001 , 7 , 35.00 <-- duplicate store number
Then I do this query to get unique store number and also the cheapest price from each store:
SQL= "Select distinct on (storenumber), itemsku, storenumber,price
from storeproduct where itemsku='10001'
order by storenumber, price"
Result #1:
ItemSku , StoreNumber , Price
The question is how to make the query that returns as above but sorted by price?
Thanks..
Yudie