Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Access
Search
Search
 
Icon: Flag: (c) Microsoft
Get up to speed
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Calculate a value using a subquery (SQL statement)
 

You can use these expressions in a calculated field in a query.

Expression Description
Category: (SELECT [CategoryName] FROM [Categories] WHERE [Products].[CategoryID] = [Categories].[CategoryID]) Displays in the Category field the CategoryName, if the CategoryID from the Categories table is the same as the CategoryID from the Products table.
AveragePrice: (SELECT AVG([UnitPrice]) FROM [Products] WHERE [Products].[Salesman] = [Categories].[Salesman]) Displays in the AveragePrice field the average of the values in the UnitPrice field for records, where the Salesman from the Categories table is the same as the Salesman in the Products table.