Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8259841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:57:21+00:00 2026-06-08T02:57:21+00:00

In my Ms Access, I want to insert data from two different table, so

  • 0

In my Ms Access, I want to insert data from two different table, so i write the sql like this:

SELECT B.*, C.* INTO Table2 FROM Table1 AS A 
RIGHT JOIN ABC AS B ON A.HKID=B.HKID 
RIGHT JOIN DEF AS C ON A.HKID=C.HKID 
WHERE A.HKID Is Null and b.organization not like '*xxx*' and b.adj = 1 and c.[Status] = 'Suspend';"

but it had error msg when running the sql, it said syntax error.

Can I write the sql like this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:57:22+00:00Added an answer on June 8, 2026 at 2:57 am

    When you have more than one JOIN, Access’ db engine requires the use of parentheses.

    SELECT B.*, C.* INTO Table2
    FROM
        (Table1 AS A RIGHT JOIN ABC AS B ON A.HKID = B.HKID)
        RIGHT JOIN DEF AS C ON B.HKID = C.HKID
    WHERE
            A.HKID Is Null
        AND B.organization Not Like '*xxx*'
        AND B.adj=1
        AND C.Status='Suspend';
    

    Notice I used …

    RIGHT JOIN DEF AS C ON B.HKID = C.HKID
    

    instead of the way you had it …

    RIGHT JOIN DEF AS C ON A.HKID=C.HKID
    

    I had to make that change because Access complained “join not supported” when I tried ON A.HKID=C.HKID If that is not satisfactory, you will need to start over; I think I would tackle this one with the tables in the opposite order and use LEFT JOIN.

    Also, the table you create (Table2) will include fields named B_HKID and C_HKID, which come from B.HKID and C.HKID. You will see the same pattern with any other field names those 2 tables have in common. If that is unacceptable you can list the fields individually and assign aliases where needed.

    If you have Access installed, you should build this query in the query designer because it will ensure you set up the joins properly to keep the db engine happy.

    If you don’t have Access installed, and you are running this query from an ADO connection, change the wild card character in the Like string pattern from * to %.

    AND B.organization Not Like '%xxx%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using an SQL query to insert data from an excel worksheet into
How can we explicitly convert data types in INSERT INTO/SELECT queries in MS Access?
I imported data from MS-Access into a SQL database using the import/export wizard. Now,
I am copying data from MS Access to SQL Server using SSIS. Only one
I want to insert a new row into an Access database. I'm looking at
I'm trying to write a query that extracts and transforms data from a table
I have a bunch of data in MS Access. I want to create INSERT
I want to insert a date record to an Access database. Here is my
I want to access text-shadow property just like we access padding property. Means ,
I want to access a static variable from a static method: #!/usr/bin/env python class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.