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

Chapter 5. Working with Queries > Calculating in Queries

Calculating in Queries

Not only can you use Crosstab queries to summarize the data in your tables, but you can perform calculations on your data (such as finding sums, averages, and standard deviations) and display the output in your query results. For this example, we'll create a calculation to estimate the length of the first drafts of the books in our library.

To perform calculations in queries:

1.
Create a query in Design view and add the tables and fields you want to use.

For this example we added the Authors, BookAuthors, and Books tables to the query design screen. From there, we selected the LastName field from the Authors table and the PublisherName and Pages fields from the Books table.

2.
Click the next open Field cell and type the expression you want to use to calculate the value for the field ( Figure 5.34 ).

Figure 5.34. Type the calculation you want to perform in the next open Field cell.


We entered a simple expression to estimate the pages in the first draft of a book, but yours can be as complex as you like. If you want to use the Expression Builder, click the Build button ( Figure 5.35 ).

Figure 5.35. Build your new expression using the Expression Builder.


3.
Click the Run button to set your query in motion ( Figure 5.36 ).

Figure 5.36. You're off and running again!



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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