Question posted 2009 · +4 upvotes
Can anyone explain to me what is wrong with my query?
SELECT T2.TIPOPRODUTO
, T2.PRODUTO
, T1.ESPESSURA
, '' AS LARGURA
, '' AS COMPRIMENTO
, '' AS [ACABAM REVEST]
, '' AS [ESPECIF QUALIDADE]
, T1.CÃDIGORASTREABILIDADE
, T3.DATA
, T4.NOMEFANTASIA
, T7.NOME
, T5.DT_INICIO_RESERVA
, T1.PESO
, T5.DT_FIM_RESERVA
, '' AS DESTINO
, T3.OBSERVAÃÃO
, '' AS [CUSTO TOTAL]
FROM ([TABELA DE PRODUTOS/ESTOQUE] LEFT OUTER JOIN [TABELA DE PRODUTOS] ON ([TABELA DE PRODUTOS/ESTOQUE].PRODUTO=[TABELA DE PRODUTOS].ID))
, [TABELA DE PRODUTOS/ESTOQUE ] AS T1
, [TABELA DE PRODUTOS] AS T2
, [TABELA DE MOVIMENTAÃÃO DE ESTOQUE] AS T3
, [TABELA DE FORNECEDORES] AS T4
, RESERVAS_PRODUTOS_ESTOQUE AS T5
, [TABELA DE MOVIMENTAÃÃO DE PRODUTOS/ESTOQUE] AS T6
, [TABELA DE USUÃRIOS] AS T7
, [TABELA DE PEDIDOS DE COMPRA] AS T8
WHERE (((T1.Produto)=[T2].[ID])
AND ((T1.ID)=[T5].[ID_PRODUTO_ESTOQUE])
AND ((T5.id_vendedor)=[T7].[ID])
AND ((T3.ID)=[T6].[ID])
AND ((T2.ID)=[T6].[PRODUTO])
AND ((T4.ID)=[T8].[FORNECEDOR])
AND ((T8.Comprador)=[T7].[ID]));
My best guess is it fails on this line:
([TABELA DE PRODUTOS/ESTOQUE] LEFT OUTER JOIN [TABELA DE PRODUTOS] ON ([TABELA DE PRODUTOS/ESTOQUE].PRODUTO=[TABELA DE PRODUTOS].ID))
Accepted answer +8 upvotes
You are mixing a join statement with “classical joins” (a comma separated list of tables with conditions in the where statement), which I believe is not allowed.
Change the query to use only join statements. In Access you have to pair the joins using parentheses, in this manner:
from (((t1 join t2 on ...) join t3 on ...) join t4 on ...)
Top ms-access Q&A (6)
- How can I modify a saved Microsoft Access 2007 or 2010 Import Specification? +31 (2008)
- OleDbCommand parameters order and priority +28 (2009)
- Is there an equivalent to the SUBSTRING function in MS Access SQL? +26 (2009)
- What do I need to read Microsoft Access databases using Python? +25 (2009)
- MS Access library for python +24 (2009)
- is there any replacement of Access? +21 (2009)
ms-access solutions on this site
.