T-SQL 101: 116 Using Subqueries in SQL Server T-SQL
Subqueries allow us to reuse data from one query in another query. There are three basic ways that this can work:
Row sets (tables) - a subquery can return an entire row set with columns. The basic structure of that is shown in the example above.
Lists - a type of row set that has a single column. It’s often used with an IN clause.
Scalar values - a single value returned from a query i.e., one row with one column. These are often used in place of values in expressions or predicates.
2025-02-16