Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Union/Make table (2000-->)

    I have a union query that I wish to make into a table, the syntax as follows:

    SELECT *

    from qrymatchesDomestic9

    UNION Select *

    from qrymatchesdomesticnon9;

    I know the method of making a new make table query from this union query but is there is a way of doing the whole lot in one query?
    Jerry

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Union/Make table (2000-->)

    You can use this, although it doesn't make the query more "readable":

    SELECT q.* INTO tblNew FROM [SELECT * FROM qrymatchesDomestic9 UNION SELECT * FROM qrymatchesdomesticnon9]. AS q

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Union/Make table (2000-->)

    That's the <img src=/S/baby.gif border=0 alt=baby width=15 height=15>
    Jerry

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Union/Make table (2000-->)

    It's harder to debug than a separate union query and a make-table query based on the union query, though.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Union/Make table (2000-->)

    Thanks that is a good point, it was just that my PC was crunching along and was seeing if there was any impact on performance using this method.

    I tested the union on an access db and then transfered the whole lot to a sql server. Thanks for the PS it makes sense <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Jerry

Posting Permissions

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