Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Access SQL Query - syntax error(missing operator) in query expression

I am trying to understand why my query(below) displays an error message in MS Access Sql query editor(sqlview) when I run it.

SELECT *
FROM tblUSPS
INNER JOIN   tblProductUSPS 
ON tblProductUSPS.[PRODUCTUSPS_USPS] = tblUSPS.[USPS_CODE] 
INNER JOIN  tblAttribute 
ON tblUSPS.USPS_ID = tblAttribute.ATTRIBUTE_USPSID

As far as I know the script below if I delete either of the INNER join lines. For instance, this script runs with no errors

SELECT *
FROM tblUSPS
INNER JOIN   tblProductUSPS 
ON tblProductUSPS.[PRODUCTUSPS_USPS] = tblUSPS.[USPS_CODE] 

And so does this

SELECT *
FROM tblUSPS  
INNER JOIN  tblAttribute ON tblUSPS.USPS_ID = tblAttribute.ATTRIBUTE_USPSID

But when I combine, something goes wrong and I am unable to find it so I would like some help identifying this please.

like image 438
Kobojunkie Avatar asked Dec 27 '22 19:12

Kobojunkie


1 Answers

Access has strong opinions on parentheses.

SELECT *
  FROM 
(tblUSPS
INNER JOIN   tblProductUSPS 
   ON tblProductUSPS.[PRODUCTUSPS_USPS] = tblUSPS.[USPS_CODE] )
INNER JOIN  tblAttribute 
   ON tblUSPS.USPS_ID = tblAttribute.ATTRIBUTE_USPSID
like image 85
Fionnuala Avatar answered Dec 30 '22 12:12

Fionnuala