Groups | Blog | Home
all groups > sql server (alternate) > january 2004 >

sql server (alternate) : Syntac error (missing operator)


Mark
1/7/2004 7:49:29 AM
Hi - I can get this to work in SQL Server - but when also trying to make
the application compatible with MS Access I get an error:

Select tblfaqnetgroups.group_name from tblfaqnetroles
Inner Join tblfaqnetgroups ON tblfaqnetroles.group_id =
tblfaqnetgroups.group_id
Inner Join tblaccess ON tblfaqnetroles.user_id = tblaccess.user_id
AND tblaccess.user_id = 1

The error in Access is:

Syntax error (missing operator) in query expression
'tblfaqnetroles.group_id = tblfaqnetgroups.group_id
Inner Join tblaccess ON tblfaqnetroles.user_id = tblaccess.user_id'

Any help would be much appreciated,

*** Sent via Developersdex http://www.developersdex.com ***
Simon Hayes
1/7/2004 1:32:10 PM

[quoted text, click to view]

This is more of an Access question, but it seems that Access requires
parentheses:

Select tblfaqnetgroups.group_name from ( tblfaqnetroles
Inner Join tblfaqnetgroups ON tblfaqnetroles.group_id =
tblfaqnetgroups.group_id )
Inner Join tblaccess ON tblfaqnetroles.user_id = tblaccess.user_id
AND tblaccess.user_id = 1

This syntax appears to work in MSSQL also, but the parentheses look
confusing (at least to me), as they suggest a derived table where there
isn't one.

Simon

Erland Sommarskog
1/7/2004 11:44:26 PM
Simon Hayes (sql@hayes.ch) writes:
[quoted text, click to view]

While I agree that the parentheses here are only white noice, there
are cases where you need them:


SELECT ...
FROM a
LEFT JOIN (b JOIN c ON b.col = c.col) ON a.col = b.col

Here, you (logically) first join b and c, and then you to an outer
join between a and this result.

--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
sql NO[at]SPAM hayes.ch
1/8/2004 12:55:22 AM
[quoted text, click to view]

Thanks for the clarification - I didn't mention this since the
original post is an inner join, but that may have misled the original
AddThis Social Bookmark Button