Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Query Access/SQL 1

Status
Not open for further replies.
Joined
Mar 17, 2005
Messages
147
Location
US
I am using an access database, and when I run my query I get the following error but cannot figure out where the snytax error is.

[Microsoft][ODBC Microsoft Access Driver]Syntax error (missing operator) in query expression dbo.OrderDetails.DetailOrderID = dbo.Orders.OrderReferenceID INNER JOIN dbo.Users ON dbo.Orders.OrderUserID = dbo.Users.UserID

Here is my SQL statement:

SELECT dbo.Orders.OrderReferenceID, dbo.Orders.OrderTotal, dbo.Orders.OrderDate, dbo.Users.FullName, dbo.OrderDetails.DetailQuantity
FROM dbo.OrderDetails INNER JOIN
dbo.Orders ON dbo.OrderDetails.DetailOrderID = dbo.Orders.OrderReferenceID INNER JOIN
dbo.Users ON dbo.Orders.OrderUserID = dbo.Users.UserID
 
access requires its joins to be parenthesized
Code:
SELECT dbo.Orders.OrderReferenceID
     , dbo.Orders.OrderTotal
     , dbo.Orders.OrderDate
     , dbo.Users.FullName
     , dbo.OrderDetails.DetailQuantity
  FROM [COLOR=red]([/color]
       dbo.OrderDetails 
INNER 
  JOIN dbo.Orders 
    ON dbo.OrderDetails.DetailOrderID 
     = dbo.Orders.OrderReferenceID 
       [COLOR=red])[/color]
INNER 
  JOIN dbo.Users 
    ON dbo.Orders.OrderUserID 
     = dbo.Users.UserID

r937.com | rudy.ca
 
Thanks for helping me with this.

I tried your statement and got syntax error in join operation.

fyi.

STeve
 
yeah, well, you did you were using access, didn't you

however, those are not valid access table names

are you using linked tables to sql server?



r937.com | rudy.ca
 
The table names in access are Orders, OrderDetails, Users in access..

Thanks.
Steve
 
The table names in your statement look correct.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top