1
SELECT *
FROM tproducts
INNER JOIN torder ON tproducts.Product_ID=torder.Product_ID
INNER JOIN tcustomer ON torder.Customer_ID=tcustomer.Customer_ID

Can anyone see what is wrong with this as VB.net says that there is a missing operator and i cant spot it?

5
  • What is the error you are getting? What database are you using? Commented Dec 2, 2014 at 16:29
  • Have you tried by enclosing each join with parantheses ? Commented Dec 2, 2014 at 16:29
  • 2
    VB.net -- are you using MS Access? It has unique and finicky requirements for enclosing joins in (). Your SQL looks like it would be valid in any other RDBMS as long as the columns exist. Commented Dec 2, 2014 at 16:30
  • look like fine till now, include what the error you getting and include vb.net code also where are you calling this? Commented Dec 2, 2014 at 16:30
  • I am using MS access 2003 Commented Dec 2, 2014 at 16:31

1 Answer 1

4

In MS Access, you need to use parentheses for multiple joins:

SELECT *
FROM (tproducts INNER JOIN
      torder
      ON tproducts.Product_ID = torder.Product_ID
     ) INNER JOIN
     tcustomer
     ON torder.Customer_ID = tcustomer.Customer_ID;

No other database requires this, and using parentheses like this looks awkward for any other database.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.