From the course: Access 2019: Queries

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Nest SQL code in other queries

Nest SQL code in other queries

From the course: Access 2019: Queries

Start my 1-month free trial

Nest SQL code in other queries

- [Instructor] 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 sub-query or an inner query or a nested query. Whatever you call it though, the technique can be quite useful. Let's go and take a look at an example. Sometimes you'll want to include records in your query based off of the results of another query. Often this may include a calculation based on your data. For instance, I'd like to see some details about our customers orders and also be able to see when they placed their last order with H+ Sport if they're a returning customer. We'll start the process by going up here to the Create tab and starting a new query in Design view. I'll add in the Customers table, the Orders table and the Products table. From the Customer table, I'll add in the Customer ID, the first name and the last name fields. From the Orders table, I'll grab the Order ID as well as…

Contents