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 bkrike 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.
Mar 17, 2005
147
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top