Getting the record containing the maximum value of a specified field #eg57

esproc_spl

Judy

Posted on October 14, 2024

Getting the record containing the maximum value of a specified field #eg57

Get the record containing the maximum value of a specified field, such as finding the nation that holds the first place on the Olympic Medal Table for the longest time.

Image description
maxp() function is used to get the record containing the maximum value.
SPL script:

Image description
A1 Retrieve the Olympic medal count table;
A2 Sort A1’s table by game and total medal count in descending order;
A3 Get one record, which is the first one of the ordered records, from each game;
A4 Group A3’s records by nation;
A5 Get the longest group, which has the nation occupying the first place for the longest time.

Execution result:

Image description

SPL open source address

Download

💖 💪 🙅 🚩
esproc_spl
Judy

Posted on October 14, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related