[Solved-1 Solution] Pig Order By Query ?
What is Order By ?
- The
ORDER BY
operator is used to display the contents of a relation in a sorted order based on one or more fields.
Syntax
- Given below is the syntax of the
ORDER BY
operator.
Problem:
- Now, from here we want the following output :
- Basically, we want to sort on the numbers : 10,9,16 and select the top 2 for every row.
How can we do it?
Solution 1:
- We can use the nested foreach with
ORDER BY
like below code