#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    7
    Rep Power
    0

    How to specify Natural Join in SQL/Access


    Hi, I am trying to write the following SQL code but each time I try and execute it in MS Access I get the error 'Syntax error in FROM Clause'. Am I specifying the natural join incorrectly?

    SELECT DISTINCT Customer.CustNo, CustBal
    FROM OrderTbl Natural Join Customer
    WHERE (OrdDate BETWEEN #02-01-07# AND #02-28-07#) AND CustState - 'WA';
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,262
    Rep Power
    4279
    Originally Posted by RV2
    Am I specifying the natural join incorrectly?
    i don't think there is a natural join in msaccess

    try using INNER JOIN with an appropriate ON clause
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    7
    Rep Power
    0
    Thanks for the suggestion. I have tried INNER JOIN in Access but I do not get the right output that I should. Maybe I will try exporting the table in SQL and use Natural Join.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,787
    Rep Power
    349
    Originally Posted by RV2
    Thanks for the suggestion. I have tried INNER JOIN in Access but I do not get the right output that I should. Maybe I will try exporting the table in SQL and use Natural Join.
    A natural join is an inner. It's just a short-hand notation for it (without the need to specify the join columns)
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html
  8. #5
  9. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,262
    Rep Power
    4279
    Originally Posted by RV2
    I have tried INNER JOIN in Access
    could you please show what you tried
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo