Merge two table together

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karynaweiss
    New Member
    • Nov 2008
    • 2

    Merge two table together

    Okay, this is what I have so far.

    I was trying to do a Union Query, this is the SQL information I have.
    Code:
    ELECT TRANSFORMERS.CoNo,
           TRANSFORMERS.SerialNo,
           TRANSFORMERS.KVA,
           TRANSFORMERS.Mfg,
           TRANSFORMERS.PriVoltsHigh,
           TRANSFORMERS.PriVoltsLow,
           TRANSFORMERS.SecVoltsHight,
           TRANSFORMERS.SecVoltsLow
    FROM TRANSFORMERS INNER
    UNION ALL
    SELECT TRANSFORMERS.CoNo,
           TRANSFORMERS.SerialNo,
           TRANSFORMERS.KVA,
           TRANSFORMERS.Mfg,
           TRANSFORMERS.PriVoltsHigh,
           TRANSFORMERS.PriVoltsLow,
           TRANSFORMERS.SecVoltsHight,
           TRANSFORMERS.SecVoltsLow
    FROM TRANSFORMERSNew;
    I keep getting an error "Syntax error in JOIN operation"...di d I miss something?
    Help...
    Last edited by NeoPa; Dec 23 '08, 10:50 PM. Reason: Please remember to use the [CODE] tags provided
  • ramprat
    New Member
    • Oct 2008
    • 60

    #2
    Could it be that the first word in your SQL statement says ELECT when it should say SELECT?

    Comment

    • ChipR
      Recognized Expert Top Contributor
      • Jul 2008
      • 1289

      #3
      INNER is the keyword for a type of JOIN. I've never heard of an INNER UNION ALL.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Karyna,

        Notice I reformatted the SQL code for you as well as adding the [ CODE ] tags. I wonder how so many members seem to expect us to be able to read their SQL when they just dump it in a mess without any sort of formatting. This takes no special expertise, simply a little time and effort. I don't mean to bust your chops on this, but I really just don't get how this happens so often. As this is your first post I won't make a big deal out of it (in truth I want to leave it for others to find as they search through, rather than direct it specifically at yourself).

        If you re-examine it now, you will see a number of mistakes (especially if I point them out to you) :
        1. As mentioned before, the first character is missing from the SELECT on line #1.
        2. On line #9 there is the remnants of an INNER JOIN statement. I guess someone decided to use the UNION ALL instead but failed to clear away the INNER JOIN fully.
        3. The second SELECT query in the UNION (starting at line #11) refers to the wrong table. All the lines from #11 to #18 should be referring to TRANSFORMERSNew rather than TRANSFORMERS.


        Welcome to Bytes!

        Comment

        • karynaweiss
          New Member
          • Nov 2008
          • 2

          #5
          I will make sure to put code in a proper format.

          I do have the "S" in the code...but I did not realize that INNER was not needed.

          Is there a specific book on queries in Access, that anyone can recommend.

          Thank you to all who responded.

          Merry Christmas!

          Comment

          • MindBender77
            New Member
            • Jul 2007
            • 233

            #6
            Originally posted by karynaweiss
            Is there a specific book on queries in Access, that anyone can recommend.
            I would advise using Google to assist you. There is a plethora of information out there. Just search for: "Access Query Basics" for example.

            Here is one to get started.
            Query Basics

            Hope this helps,
            Bender

            Comment

            Working...