Embedding SQL code in queries


show more Embedding SQL code in queries provides you with in-depth training on Business. Taught by Adam Wilbert as part of the Access 2010: Queries in Depth show less
please wait ...

Embedding SQL code in queries

Sometimes you will want to include records in your query based upon the results of another query. Often this may include a calculation based upon your data. For instance, instead of just selecting values that are above or below a specific and static number, you may want to select values that are above or below the average of the entire set. In other words, you'll first need to find out what the mathematical average is and then use that value to define the criteria. You can do this by writing an SQL statement right into the field or criteria rows of your query.

So let's construct a query that asks which customers have placed above average orders. Let's go into our Create menu and then Query Design. We'll add our Orders table and our Products table and click Close. So the first thing we need to do is find the average order total across our entire database. We can do that by adding Price to our query, turning on our Totals row, and then changing the Group By to Average.

If I run...

Embedding SQL code in queries
Video duration: 4m 11s 3h 2m Intermediate

Viewers:

Embedding SQL code in queries provides you with in-depth training on Business. Taught by Adam Wilbert as part of the Access 2010: Queries in Depth

Subject:
Business
Software:
Access
Author:
please wait ...