I want to find the last value of y
over an ordered partition using a query like this:
SELECT
x,
LAST_VALUE(y) OVER (PARTITION BY x ORDER BY y AS
Even that question title uses LAST_VALUE
- the question itself asks for Largest Value
!
I would just go with below:
SELECT x, MAX(y) OVER (PARTITION BY x) FROM table
And if no other fields from table involved - i would just do simple GROUP BY:
SELECT x, MAX(y) FROM table GROUP BY x
Of course, we shoudl remember that not always Largest value and MAX value are the same thing.