• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Subqueries

Subqueries allow you to embed one SELECT statement within another. By placing a subquery in a query's criteria, you can base one query on the result of another. Figure 12.37 shows an example. The query pictured finds all the customers without orders. The SQL statement looks like this:

SELECT DISTINCTROW tblCustomers.CustomerID,
     tblCustomers.CompanyName, tblCustomers.ContactName
     FROM tblCustomers
     WHERE (((tblCustomers.CustomerID) Not In (Select CustomerID from _
     tblOrders )))


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint