Results 1 to 1 of 1

Thread: Combining UNION and INSERT queries

  1. #1

    Thread Starter
    Addicted Member Kezmondo's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    166

    Combining UNION and INSERT queries

    I want to use the result of a UNION query as the source of an INSERT INTO query. I've found similar things on this very forum - like here, but I get a syntax error with all variations I try.


    Anyone tell me what's wrong with this:


    INSERT INTO tblTEMP (X,Y)
    SELECT E1 AS X,N1 AS Y
    FROM tblConnections
    UNION
    SELECT E2 AS X,N2 AS Y
    FROM tblConnections;


    I get a "Syntax error in the FROM clause".
    The E1, N1, E2, N2 fields of tblConnections are the same type as the X and Y fields of tblTemp.

    I can get around it by separating it into 2 queries, but I'd like to know why it's not working like this!


    Grrrrrrrr.
    Last edited by Kezmondo; Feb 17th, 2004 at 05:54 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
  •  



Click Here to Expand Forum to Full Width