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

5. Queries and SQL > 52. Get Cleaner And-Based Criteria

Get Cleaner And-Based Criteria

Remove the need for multiple And statements by combining the In and Not operators.

Sometimes, criteria are set up to filter out certain records instead of including them. This reversal of logic makes sense in situations in which you want to return most of the records, but not all of them. “Get Cleaner Or-Based Criteria” [Hack #51] shows how to use the In operator to better manage Or based criteria. When you set up criteria to be excluded, however, use the And operator. For example, you might ask, “Give me all states, except California and New Mexico.”

Figure 5-48 shows a query design that excludes six states from the query results. As new states are added to this list, an additional


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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