How do I call a query results in another query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zahmbonnie
    New Member
    • Apr 2010
    • 2

    #1

    How do I call a query results in another query?

    I have created two different queries and I would like take the results from one and subtract the results from the other. I can not figure out how to write the saved query name in my new query.
    Saved as Recieved.sql and Issued.sql in Microsoft SQL Server.
    I am going to take the Recieved query and subtract the Issued query in a new query.
    Any help would be appreciated. Thanks!
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    The way I would do this is first build 2 temp tables from the two queries. Then run another query which joins those two tables and does your subtraction into a new column.

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      Or make it a function or view or CTE

      Happy Coding!!!

      ~~ CK

      Comment

      • zahmbonnie
        New Member
        • Apr 2010
        • 2

        #4
        Originally posted by zahmbonnie
        I have created two different queries and I would like take the results from one and subtract the results from the other. I can not figure out how to write the saved query name in my new query.
        Saved as Recieved.sql and Issued.sql in Microsoft SQL Server.
        I am going to take the Recieved query and subtract the Issued query in a new query.
        Any help would be appreciated. Thanks!
        Thanks for your help!

        Comment

        Working...