Results 1 to 4 of 4
  1. #1
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108

    Append two queries?

    Is it possible to append two queries? The queries have the same layout and labels...it's just a matter of combining the data into one datasheet view.

    The two queries are below:

    1)

    SELECT prc.Market AS Geography, trp.Product, trp.Indication, trp.[Variable Name], trp.Period, Round(prc.Index*trp.[Variable Value],2) AS [Variable Value], trp.Outlet, trp.Daypart, trp.[Program Name], trp.Len, trp.Creative, trp.Campaign, trp.[Campaign Name], trp.[Media Type], trp.Vendor, trp.Channel
    FROM tblTRP AS trp, tblTRPpercent AS prc
    WHERE (((trp.Indication)=prc.Indication) And ((trp.[Media Type])=prc.Type) And ((trp.Geography)="National") And ((trp.Month)=prc.Month));


    2)


    SELECT prct.DMA AS Geography, tv.Product, tv.Indication, tv.[Variable Name], tv.Period, Round(prct.percentUniverse*tv.[Variable Value],6) AS [Variable Value], tv.Outlet, tv.Daypart, tv.[Program Name], tv.Len, tv.Creative, tv.Campaign, tv.[Campaign Name], tv.[Media Type], tv.Vendor, tv.Channel
    FROM tblTVOtherMetrics AS tv, tblDMApercent AS prct


    WHERE (((tv.Geography)="National"));

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Not sure what you mean "Append Two Queries?"

    To combined two queries as one, you can use "UNION" (or UNION ALL)
    http://msdn.microsoft.com/en-us/libr.../ff821131.aspx (for the UNION/UNION ALL differences)

  3. #3
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108
    Well, I basically want to rewrite my existing queries (which are separate), so that the result is one big query as opposed to two. The two queries have the same field labels and the same type of data, so I want to consolidate them.

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    You are selecting from 4 different tables (2 tables on each query). It will not be easy to cosolidate them.

    Create another query and use UNION or UNION ALL on those 2 query should work.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Run Append and Update Queries
    By Govinda in forum Programming
    Replies: 1
    Last Post: 04-04-2013, 01:14 AM
  2. Append Queries
    By HunterEngineeringCoop in forum Queries
    Replies: 8
    Last Post: 12-12-2012, 01:10 PM
  3. Append Queries different datatypes
    By whojstall11 in forum Queries
    Replies: 1
    Last Post: 07-24-2012, 08:35 AM
  4. Error Handling & Append Queries
    By DarkWolff in forum Programming
    Replies: 11
    Last Post: 04-20-2012, 03:05 PM
  5. Append/Delete Queries
    By donnan33 in forum Queries
    Replies: 3
    Last Post: 01-13-2012, 03:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums