Do you all use sub select very often?

N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
The coding is a little bit different. I'm trying to get the hang of them.

Comments

  • NotHackingYouNotHackingYou Member Posts: 1,460 ■■■■■■■■□□
    Sub queries you mean - like this?

    SELECT SalesPersonName FROM SalesPeople WHERE SalesPersonID IN (SELECT SalesPersonID FROM Sales WHERE SaleAmount > 5000)

    Obviously this is an over simplified example and could be accomplished in a single query - but the answer to your question is yes I use them quite frequently. As a general rule, I try to stay away from going more than ~5 levels deep.
    When you go the extra mile, there's no traffic.
  • N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
    They were referring to them as sub selects not sub queries, I have written sub queries before, although I normally write joins from the data I analyze and report on. They look like they might be in some sort of XML format when they are ran. I like the aggregate function on the second piece of your query :)
Sign In or Register to comment.