SQL query problem - why

  • Thread starter Thread starter Man Utd
  • Start date Start date
M

Man Utd

I have this query:
SELECT [IASSETS].IASSETID, [IASSETS].TITLE, [EDITIONS].DESCRIPTION,
[EDITIONS].USERKEYWORDS, [DOCUMENTTYPES].DOCUMENTTYPEID AS CATID,
[IASSETS].FILEPATH AS ACTUALDOCPATH, [IASSETS].ADDRESS AS
ACTUALDOCNAME,
[IASSETS].ISACTIVE, [PROCEDURETYPES].PROCEDURETYPEID AS
SYSTEMID
FROM [IASSETS]
LEFT JOIN [EDITIONS] ON ([EDITIONS].IASSETID = i.IASSETID) AND
([EDITIONS].EDITIONID = [IASSETS].CURRENTEDITIONID)
LEFT JOIN [PROCEDURETYPES] ON
[PROCEDURETYPES].PROCEDURETYPEID = [EDITIONS].PROCEDURETYPEID
LEFT JOIN [DOCUMENTTYPES] ON [DOCUMENTTYPES].DOCUMENTTYPEID =
[EDITIONS].DOCUMENTTYPEID

I got an sql query problem: EOleException with message
'Syntax error(missing operator) in query expression:

([EDITIONS].IASSETID = i.IASSETID) AND ([EDITIONS].EDITIONID =
[IASSETS].CURRENTEDITIONID)
LEFT JOIN [PROCEDURETYPES] ON [PROCEDURETYPES].PROCEDURETYPEID =
[EDITIONS].PROCEDURETYPEID
LEFT JOIN [DOCUMENTTYPES] ON [DOCUMENTTYPES].DOCUMENTTYPEID = [EDITIONS

Anyone knows what did I do something wrong?
 
Sorry please accept my apology, please ignore my first post, I have typo.

It should be:

SELECT [IASSETS].IASSETID,
[IASSETS].TITLE,
[EDITIONS].DESCRIPTION,
[EDITIONS].USERKEYWORDS,
[DOCUMENTTYPES].DOCUMENTTYPEID AS CATID,
[IASSETS].FILEPATH AS ACTUALDOCPATH,
[IASSETS].ADDRESS AS ACTUALDOCNAME,
[IASSETS].ISACTIVE,
[PROCEDURETYPES].PROCEDURETYPEID AS SYSTEMID
FROM [IASSETS]
LEFT JOIN [EDITIONS] ON ([EDITIONS].IASSETID = [IASSETS].IASSETID) AND
([EDITIONS].EDITIONID =
[IASSETS].CURRENTEDITIONID)
LEFT JOIN [PROCEDURETYPES] ON [PROCEDURETYPES].PROCEDURETYPEID =
[EDITIONS].PROCEDURETYPEID
LEFT JOIN [DOCUMENTTYPES] ON [DOCUMENTTYPES].DOCUMENTTYPEID =
[EDITIONS].DOCUMENTTYPEID

I got an sql query problem: EOleException with message
'Syntax error(missing operator) in query expression:

"([EDITIONS].IASSETID = [IASSETS].IASSETID) AND ([EDITIONS].EDITIONID =
[IASSETS].CURRENTEDITIONID)
LEFT JOIN [PROCEDURETYPES] ON [PROCEDURETYPES].PROCEDURETYPEID =
[EDITIONS].PROCEDURETYPEID
LEFT JOIN [DOCUMENTTYPES] ON [DOCUMENTTYPES].DOCUMENTTYPEID = ["

Anyone knows what did I do something wrong?
 
You need parentheses for each join except the outer most join.

Try:

FROM
( ( [IASSETS] LEFT JOIN [EDITIONS]
ON ([EDITIONS].IASSETID = [IASSETS].IASSETID)
AND ([EDITIONS].EDITIONID = [IASSETS].CURRENTEDITIONID)
) LEFT JOIN [PROCEDURETYPES]
ON [PROCEDURETYPES].PROCEDURETYPEID =
[EDITIONS].PROCEDURETYPEID
) LEFT JOIN [DOCUMENTTYPES]
ON [DOCUMENTTYPES].DOCUMENTTYPEID =
[EDITIONS].DOCUMENTTYPEID
 
SELECT ...
FROM ....
WHERE ...
ORDER BY ...

Check the JET SQL Reference section of Access Help.
 
Back
Top