Skip to content

Query the maximum value in a window

Use the first_value function to query the maximum value in a window.

SQL
* |
select
  __time__,
  first_value(streamValue) over(
    PARTITION BY streamValue
    order by
      status desc
  ) as sallary_rank
order by
  streamValue,
  sallary_rank