By Andrew Gould
Writing SQL for Excel with ADODB playlist https://youtube.com/playlist?list=PLNIs-AWhQzckUd5i0E1xeSFeBAonYIurK
VBA Working with Databases playlist https://youtube.com/playlist?list=PLNIs-AWhQzclbRVLCZlsFvpz6fz2nPGbt
Get files here https://www.wiseowl.co.uk/vba-macros/videos/vba-ado-net-recordsets/sql-excel-subqueries
If you'd like to help fund Wise Owl's conversion of tea and biscuits into quality training videos you can join this channel to get access to perks:
https://www.youtube.com/channel/UCbi5G5PjWBaQUFy7XU_O7yw/join
Or you can click this link https://www.wiseowl.co.uk/donate?t=1 to make a donation. Thanks for watching!
This video explains how to nest one Select statement inside another Select statement to create a subquery. You'll learn how to use subqueries to return different levels of aggregation in the same Select statement and use this to compare rows against the average value of a dataset and to calculate the contribution of one row to the total. You'll see how to add criteria to a subqery and also how to use a subquery to set criteria for the main query. You'll also learn how to handle multiple rows returned by a subquery using the IN, ALL and ANY keywords
Chapters
00:00 Topic List
00:41 The Basic Setup
02:31 Mixing Aggregated and Non-aggregated Columns
03:52 Calculating the Average in a Subquery
04:49 Subtracting the Result of the Subquery
05:34 Calculating the Contribution to the Total
07:33 Criteria in Subqueries
10:57 Subqueries in Criteria
12:37 Using the Subquery Result in Other Expressions
13:26 Multiple Subqueries in the Where Clause
14:49 Adding Criteria to the Subqueries
16:44 Returning Multiple Values from a Subquery
20:42 Using the ALL Keyword
23:11 Using the ANY Keyword
Visit www.wiseowl.co.uk for more online training resources in Microsoft Excel, Power BI, DAX, SQL Server, Reporting Services, Analysis Services, Integration Services, ASP.NET, C#, Visual Basic, Microsoft Access and more