From the course: Access 2016: Queries

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Nest SQL code in other queries

Nest SQL code in other queries

From the course: Access 2016: Queries

Nest SQL code in other queries

- [Voiceover] Occasionally, you might find the technique of embedding an SQL select statement inside of other queries to be helpful in organizing your data. Sometimes this is referred to as a subquery or an inner query or a nested query. Now whatever you call it, the technique can be quite useful, so let's take a look at an example. Sometimes you'll want to include records in your query based on the results of another query. Often this may include a calculation based off of your data, for instance, I'd like to see some details about our customer's orders and also be able to see when they placed their last order with the H Plus Sport Company. To do this we'll start a new query in design view and we'll pull out some information from our customers table, our orders table and our products table. From these tables I'll choose the customer ID, first name and last name. From the orders table I'll grab the order ID and we'll scroll down and get the date and then from the products table I'm…

Contents