Results 1 to 3 of 3
  1. #1
    Fionfion is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    25

    Union query but just add the result of each query instead of mixing the records

    There are around 12 queries in my database, and I intensionally named them in alphabetical order.



    I am trying to append the queries results like below:
    Query A result
    (An empty line)
    Query B result
    (An empty line)
    Query C result
    (An empty line)
    ....

    I have tried Union query, but it will mix all the results together when I just want them to append.

    Please help... Thanks in advance!!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    Assuming are talking about say two fields try something like

    SELECT fld1, fld2 FROM
    (SELECT 1 AS ord, fld1, fld2
    FROM query1
    UNION SELECT 2 AS ord, null, null
    FROM Query1
    UNION SELECT 3 AS ord, fld1, fld2
    FROM Query2
    UNION SELECT 4 AS Ord, null, null
    FROM Query1

    …) AS UC
    ORDER BY Ord

    although I don't understand why you would want to do this. If for presentation purposes, I would suggest it is not the way to go. Certainly don't understand why you would want to append blank records to a table

  3. #3
    Fionfion is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    25
    Quote Originally Posted by Ajax View Post
    Assuming are talking about say two fields try something like

    SELECT fld1, fld2 FROM
    (SELECT 1 AS ord, fld1, fld2
    FROM query1
    UNION SELECT 2 AS ord, null, null
    FROM Query1
    UNION SELECT 3 AS ord, fld1, fld2
    FROM Query2
    UNION SELECT 4 AS Ord, null, null
    FROM Query1

    …) AS UC
    ORDER BY Ord

    although I don't understand why you would want to do this. If for presentation purposes, I would suggest it is not the way to go. Certainly don't understand why you would want to append blank records to a table
    Thank you so much for your help it worked perfectly! And yes it is for presentation purpose

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

Similar Threads

  1. Replies: 4
    Last Post: 08-09-2017, 12:06 PM
  2. Replies: 6
    Last Post: 12-28-2016, 06:57 AM
  3. Replies: 2
    Last Post: 10-16-2015, 10:15 PM
  4. Suming Duplicate Records in Union Query
    By Sqnwk in forum Access
    Replies: 1
    Last Post: 10-30-2012, 06:10 PM
  5. Union Query Dropping Records
    By Bedsingar in forum Queries
    Replies: 2
    Last Post: 07-18-2011, 09:29 AM

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