Consulting

Results 1 to 2 of 2

Thread: Solved: Need to Store query results for use by another query

  1. #1
    VBAX Newbie
    Joined
    Feb 2012
    Location
    San Antonio, Tx
    Posts
    2
    Location

    Red face Solved: Need to Store query results for use by another query

    I am new to VBA and need some help figuring out how to query a table, store the result (single field), then use that result for another query to get additional data from another table. I have not had luck with a nested query, can't figure out caching. The problem is the history table which stores multiple lines of data for the same reference number. I need to pull the unique reference numbers then use them to get detailed data from another table. I can get the data ok, just can't figure out how to use it for the other query.

    The initial query looks like ths:
    Select RPT_INCIDENT_HISTORY_PV.CALL_NUMBER
    from RPT_INCIDENT_HISTORY_PV
    WHERE RPT_INCIDENT_HISTORY_PV.HISTORY_DATE > '1/1/2012' AND RPT_INCIDENT_HISTORY_PV.Assign_Grp ='P&C Policy Svc TS'
    GROUP BY RPT_INCIDENT_HISTORY_PV.CALL_NUMBER

    This gets me what I need. How do I store it for use by the second query?

    Thank you for your assistance. Patrick

  2. #2
    VBAX Tutor mohanvijay's Avatar
    Joined
    Aug 2010
    Location
    MADURAI
    Posts
    268
    Location
    SELECT * FROM TestTable WHERE TestTable.Number IN (Put above query here)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •