| YEAR | sales |
|---|---|
| 2021 | 1000 |
| 2022 | 1500 |
| 2023 | 2000 |
I want show 3rd column min sales with window function. But year=2022.
| YEAR | sales | min |
|---|---|---|
| 2021 | 1000 | 1500 |
| 2022 | 1500 | 1500 |
| 2023 | 2000 | 1500 |
I've tried the following query, but it didn't return the desired result:
select *,min(sales) over (partiton by year=2022) from table
It doesn't have anything to do with window functions: