6.3.1: Top Values

You can change the selection for Top Values. The default is ALL which results in all rows displayed when the query is run, but you can use this property to limit the rows displayed. As indicated below you can type an explicit number of rows such as 5, or a specific percentage of rows to be displayed.


                                                  Figure 6.9: Setting the Top Values property


Consider the Library database where the Member table has one row per member. Sample are shown below:


                    Figure 6.10: Sample library members

Suppose we wanted to know who is the youngest member. One way to find out is to sort the members by birthdate and then pick either the first or last row according to how you ordered them (descending or ascending). Consider the following where the members are sorted in descending order by birthdate and then we list the first row by specifying Top Values = 1:


Figure 6.11: The youngest member using Top Values=1

For the sample rows the query produces the result:


Figure 6.12: Query returns one result row

Share This Book