By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,790 Members | 1,398 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,790 IT Pros & Developers. It's quick & easy.

Merge two table together

P: 2
Okay, this is what I have so far.

I was trying to do a Union Query, this is the SQL information I have.
Expand|Select|Wrap|Line Numbers
  1. ELECT TRANSFORMERS.CoNo,
  2.        TRANSFORMERS.SerialNo,
  3.        TRANSFORMERS.KVA,
  4.        TRANSFORMERS.Mfg,
  5.        TRANSFORMERS.PriVoltsHigh,
  6.        TRANSFORMERS.PriVoltsLow,
  7.        TRANSFORMERS.SecVoltsHight,
  8.        TRANSFORMERS.SecVoltsLow
  9. FROM TRANSFORMERS INNER
  10. UNION ALL
  11. SELECT TRANSFORMERS.CoNo,
  12.        TRANSFORMERS.SerialNo,
  13.        TRANSFORMERS.KVA,
  14.        TRANSFORMERS.Mfg,
  15.        TRANSFORMERS.PriVoltsHigh,
  16.        TRANSFORMERS.PriVoltsLow,
  17.        TRANSFORMERS.SecVoltsHight,
  18.        TRANSFORMERS.SecVoltsLow
  19. FROM TRANSFORMERSNew;
I keep getting an error "Syntax error in JOIN operation"...did I miss something?
Help...
Dec 23 '08 #1
Share this Question
Share on Google+
5 Replies


P: 60
Could it be that the first word in your SQL statement says ELECT when it should say SELECT?
Dec 23 '08 #2

Expert 100+
P: 1,287
INNER is the keyword for a type of JOIN. I've never heard of an INNER UNION ALL.
Dec 23 '08 #3

NeoPa
Expert Mod 15k+
P: 31,418
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!
Dec 23 '08 #4

P: 2
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!
Dec 24 '08 #5

MindBender77
100+
P: 234
@karynaweiss
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
Dec 24 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.