• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Using SQL > Limiting the Number of Records in a Set

Limiting the Number of Records in a Set

A database can contain millions of records but you rarely, if ever, want to display them all on a Web page. You can limit the records you retrieve from a database by using the SQL WHERE clause.

To create a recordset with only specific records:

In the Application panel group, click on the Data Bindings panel.

Click the + (plus) button. Select Recordset (Query) from the menu.

In the Recordset dialog box, type a name for your recordset, select your connection from the Connection drop-down menu, and select the appropriate table from the Table drop-down menu.

Select a field name from the first Filter drop-down menu.

This is the field name in the WHERE clause.

From the second Filter drop-down menu (just to the right of the first one), select the operator (=, >, < etc.) that describes how you want to limit your data (Figure 4.15).

Figure 4.15. You can use the Filter drop-down menus to limit the records you get.

In the third Filter drop-down menu (just below the first drop-down), select Entered Value.

Finally, in the text box to the right, type the value you want to test against.

Of course, if you click on the Advanced button, you will see the SQL behind the scenes, with the WHERE clause included (Figure 4.16).

Figure 4.16. Using the Filter drop-down menus creates a SQL WHERE clause


  • You can request an exact match, a range of values (such as greater than 10 or less than 10,000), or a “like” match. One example of a “like” match would be phone numbers starting with 415, in which case you’d type 415% as your value.

  • The % (percent sign) is a variable in SQL that allows for partial searches rather than exact matches. If you use a “like” match and type a partial search string followed by a %, the database will return all matches that start with that phrase. So requesting “White%” would return “Whitening,” “Whitehouse,” and “White Castle”. Requesting “Whiteh” would return “Whitehouse,” but not the others just mentioned.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint