Skip to content
Advertisement

SQL- Find the price of the smallest product in a store

I would like to find the price of the smallest product in a store and in addition, in another column, populate this price in all the products of the same store. Here is my table and the desired result in the “results” column:

Table1

Here is my request but it does not populate the price:

SELECT local ,product ,price ,IIF(MIN(Product) OVER (PARTITION BY Local)=Product,Price,NULL) as Results FROM Table1

Thanks

Advertisement

Answer

If you want price of the smallest product:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement