Press "Enter" to skip to content

Finding the Nth Row in a Dataset

Reitse Eskens shows off a good use case for window functions:

Last week, one of my coworkers had a nice case. From a dataset, he needed the third row based on an indicator and a timestamp. That sounded a bit vague so I started out with creating a table that contained some records with the columns he’d have to filter on.

This turns out to be an ideal use of the ROW_NUMBER() function.