Results 1 to 10 of 10
  1. #1
    jakenh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    5

    Unhappy Interesting error coming up from my SQL code in query

    I have 2 tables: Doc4 and Total. In each of these 2 tables I have a column called "University". I'm trying to perform a JOIN on these by using the following code:
    Code:
    SELECT *
    FROM Doc4
    JOIN Total
    ON Doc4.University = Total.University
    When I run the query I am getting the error "Syntax error in FROM clause. Any ideas why? I have also tried
    Code:
    SELECT University 
    FROM Doc4
    JOIN Total
    ON Doc4.University = Total.University
    But that is raising the same error.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Try INNER JOIN, but TOTAL is probably a reserved word.

  3. #3
    jakenh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    5
    I changed Total to Main-Table and changed JOIN to INNER JOIN and I'm still getting the same error.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Show us some sample data in your tables.

  5. #5
    jakenh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    5
    Doc4


    University
    ALEXANDRIA TECHNICAL COLLEGE
    AMERICAN INTERNATIONAL COLLEGE
    ARCHER HIGH SCHOOL
    ASA, THE COLLEGE FOR EXCELLENCE
    AVERY HILL COLLEGE
    BAUDER COLLEGE
    BETHEL SEMINARY ST PAUL


    Main-Table
    University
    Unlisted College
    McLennan Community College
    McMurry University
    Texas St Tech College Waco
    Texas St Tech College West Texas
    Total College Transfer Hours
    Univ Of Utah

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    ??? When you join tables, you are matching of equal values of the fields involved.
    Code:
    .....Doc4
    INNER JOIN Total
    ON Doc4.University = Total.University
    is saying

    Get me info from t1 joined to t2 where the value in the University field is the same in both tables.

    Perhaps you should tell us in very simple English WJHAT you are trying to accomplish.

    It appears you have misunderstood the meaning/purpose of JOIN (INNER JOIN)

  7. #7
    jakenh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    5
    In both Doc4 table and Main-Table there is a column for University. In Main-Table, University column has about 16,000 values. In Doc4, University has about 3,000. Some of the 3,000 in Doc4 are duplicates of those in Main-Table. Basically I would like to merge these two tables into one table, combining similar universities.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    And which table is to have the merged result.

    Do you not have any other fields in your table eg an Id field PK?

  9. #9
    jakenh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    5
    Sorry for the late reply. The table "Main-Table" is to have the merged result. I have fields in Doc4 that differed from Main-Table, so I made the fields in Main-Table but didn't fill any values in for them.

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Code:
    INSERT INTO [Main-Table]
    SELECT   University
    FROM [Total]
    WHERE  [University] Not In (Select university from [Main-Table]  );

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

Similar Threads

  1. Error started coming up when Jobs run
    By RayMilhon in forum SQL Server
    Replies: 1
    Last Post: 11-05-2014, 04:52 PM
  2. Replies: 3
    Last Post: 05-29-2012, 09:01 AM
  3. #NAME? Error keeps coming back
    By tharless in forum Access
    Replies: 24
    Last Post: 02-09-2012, 03:10 PM
  4. Interesting Query, Need help!!
    By accessdba in forum Queries
    Replies: 1
    Last Post: 10-06-2011, 11:54 AM
  5. Interesting Query Problem
    By Lockrin in forum Queries
    Replies: 7
    Last Post: 08-23-2010, 01:56 PM

Tags for this Thread

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