Select the column where the sorting order are based.
If you have not selected a target entity when selecting columns for results, you can select Distinct so that you can only select from the columns that you have selected.
Click Add to add that column to the sorting order.
To limit the number of the resulting rows, type a number in TOP field.