• 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 11.38 shows an example. The query pictured finds all the clients without projects. The SQL statement looks like this:

SELECT DISTINCTROW tblClients.ClientID,
     tblClients.CompanyName FROM tblClients
     WHERE tblClients.ClientID Not In (Select ClientID from tblProjects)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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