Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Why not ORDER BY value NULLS FIRST instead of your CASE clause?
    – S-Man
    Commented Sep 25, 2019 at 12:46
  • Sure, that would give the same (incorrect) result. I was just trying to use the syntax that @thebuleon29 used.
    – Jeremy
    Commented Sep 25, 2019 at 12:51
  • Thanks a lot for your answer, but I am even more confused now. The ORDER BY is applied to the result as well ? I though it was only for ordering the frame before LAST_VALUE picked its result.
    – Gaëtan
    Commented Sep 25, 2019 at 12:59
  • We didn't specify an order for the result, if we had, we could order by whatever we want.
    – Jeremy
    Commented Sep 25, 2019 at 13:15