SQL Server 2008: How to Use Subqueries in SQL


show more Using subqueries provides you with in-depth training on Business. Taught by Simon Allardice as part of the SQL Server 2008 Essential Training show less
please wait ...

Using subqueries

As you get more comfortable with writing SQL statements, you'll find yourself wanting to combine information from multiple tables more often than not and though a join is a classic way of doing it, it's not the only way. There is another way called a sub- query and let me explain that by kind of taking you step-by-step through the roadmap of how you might get there. So we start with something really simple. We've got a SELECT * statement here. It'll give me everything from SalesOrderHeader. Now if I execute that, I'm getting all the totaling of my sales orders, including things like the customer IDs and the subtotal, and the total due.

And I of course can scan this information just fine and look at it, but what if I'm more interested in specific stuff. What about if I want to know information about the biggest order that ever happened? Well, I could, of course, just do something very simple like an ORDER BY. TotalDue, which of course will give it to me ascending wh...

Using subqueries
Video duration: 9m 33s 6h 54m Beginner

Viewers:

Using subqueries provides you with in-depth training on Business. Taught by Simon Allardice as part of the SQL Server 2008 Essential Training

Subjects:
Business Developer IT
Software:
SQL Server
Author:
please wait ...