Skip to content

Query the values after the specified line in a window and return the default value if no value is available

Use the lead function to query the values after the specified line in a window and return the default value if no value is available.

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