Subqueries Archives

Subqueries provide a powerful means to combine data from one or more table into one result.  They are sometimes called nested queries.  As the name implies, they one or more queries, one inside one another other.

IF you’re unfamiliar them, then your first order of business should be to read our article Introduction to Subqueries.  This is super place to start.

They can be used in many places throughout the SELECT statement.

All the examples for this lesson are based on Microsoft SQL Server Management Studio and the sample databases AdventureWorks and WideWorldImporters.  You can get started using these free tools using my guide Getting Started Using SQL Server


Is it possible to use Joins, Subqueries, and Unions in one Query?

A reader recently asked me to help them solve a problem combining data from multiple tables into a single result.  What was interesting was that the solution used the three ways to combine data that we have recently covered, namely:  JOINS, set operators, and subqueries. Given the comprehensive nature of this problem I thought it […]

Continue reading